This is an automated email from the ASF dual-hosted git repository. blerer pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push: new c133385 Fix CasWriterTest after CASSANDRA-15689 c133385 is described below commit c133385986db9fb1333b37739528f66ad45de916 Author: David Capwell <dcapw...@gmail.com> AuthorDate: Fri Apr 3 10:56:20 2020 -0700 Fix CasWriterTest after CASSANDRA-15689 patch by David Capwell; reviewed by Benjamin Lerer for CASSANDRA-15689 --- .../cassandra/distributed/test/CasWriteTest.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/distributed/org/apache/cassandra/distributed/test/CasWriteTest.java b/test/distributed/org/apache/cassandra/distributed/test/CasWriteTest.java index a5d7e72..1d886cf 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/CasWriteTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/CasWriteTest.java @@ -167,8 +167,8 @@ public class CasWriteTest extends TestBaseImpl failure -> failure.get() != null && failure.get() - .getMessage() - .contains(CasWriteTimeoutException.class.getCanonicalName()), + .getClass().getCanonicalName() + .equals(CasWriteTimeoutException.class.getCanonicalName()), "Expecting cause to be CasWriteTimeoutException"); } @@ -217,8 +217,7 @@ public class CasWriteTest extends TestBaseImpl private void expectCasWriteTimeout() { - thrown.expect(RuntimeException.class); - thrown.expectCause(new BaseMatcher<Throwable>() + thrown.expect(new BaseMatcher<Throwable>() { public boolean matches(Object item) { @@ -232,7 +231,18 @@ public class CasWriteTest extends TestBaseImpl }); // unable to assert on class becuase the exception thrown was loaded by a differnet classloader, InstanceClassLoader // therefor asserts the FQCN name present in the message as a workaround - thrown.expectMessage(containsString(CasWriteTimeoutException.class.getCanonicalName())); + thrown.expect(new BaseMatcher<Throwable>() + { + public boolean matches(Object item) + { + return item.getClass().getCanonicalName().equals(CasWriteTimeoutException.class.getCanonicalName()); + } + + public void describeTo(Description description) + { + description.appendText("Class was expected to be " + CasWriteTimeoutException.class.getCanonicalName() + " but was not"); + } + }); thrown.expectMessage(containsString("CAS operation timed out")); } @@ -256,8 +266,8 @@ public class CasWriteTest extends TestBaseImpl } catch (Throwable t) { - Assert.assertTrue("Expecting cause to be CasWriteUncertainException", - t.getMessage().contains(CasWriteUnknownResultException.class.getCanonicalName())); + Assert.assertEquals("Expecting cause to be CasWriteUncertainException", + CasWriteUnknownResultException.class.getCanonicalName(), t.getClass().getCanonicalName()); return; } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org