diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/BookieBackpressureTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/BookieBackpressureTest.java index 1fe7c3ddbf0..a0d81d708d5 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/BookieBackpressureTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/BookieBackpressureTest.java @@ -49,8 +49,8 @@ import org.apache.bookkeeper.client.LedgerHandle; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.test.BookKeeperClusterTestCase; +import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; @@ -286,7 +286,7 @@ public void testReadsNoBackpressure() throws Exception { final BookieRequestProcessor brp = generateDataAndDoReads(0); - Assert.assertThat("reads in progress should exceed MAX_PENDING", + MatcherAssert.assertThat("reads in progress should exceed MAX_PENDING", brp.maxReadsInProgressCount(), Matchers.greaterThan(MAX_PENDING)); } @@ -301,12 +301,12 @@ public void testReadsWithBackpressure() throws Exception { final BookieRequestProcessor brp = generateDataAndDoReads(0); - Assert.assertThat("reads in progress should NOT exceed MAX_PENDING ", + MatcherAssert.assertThat("reads in progress should NOT exceed MAX_PENDING ", brp.maxReadsInProgressCount(), Matchers.lessThanOrEqualTo(MAX_PENDING)); } private BookieRequestProcessor generateDataAndDoReads(final int bkId) throws Exception { - Assert.assertThat("should be only one bookie", + MatcherAssert.assertThat("should be only one bookie", bookieCount(), Matchers.equalTo(1)); ServerConfiguration conf = killBookie(0); BookieServer bks = startAndAddBookie(conf, @@ -347,7 +347,7 @@ private BookieRequestProcessor generateDataAndDoReads(final int bkId) throws Exc // here we expect that backpressure is disabled and number of writes in progress // will exceed the limit private void doWritesNoBackpressure(final int bkId) throws Exception { - Assert.assertThat("should be only one bookie", + MatcherAssert.assertThat("should be only one bookie", bookieCount(), Matchers.equalTo(1)); ServerConfiguration conf = killBookie(0); BookieServer bks = startAndAddBookie(conf, @@ -392,7 +392,7 @@ private void doWritesNoBackpressure(final int bkId) throws Exception { // here we expect that backpressure is enabled and number of writes in progress // will never exceed the limit private void doWritesWithBackpressure(final int bkId) throws Exception { - Assert.assertThat("should be only one bookie", + MatcherAssert.assertThat("should be only one bookie", bookieCount(), Matchers.equalTo(1)); ServerConfiguration conf = killBookie(0); BookieServer bks = startAndAddBookie(conf, diff --git a/stream/statelib/src/test/java/org/apache/bookkeeper/statelib/testing/executors/MockExecutorController.java b/stream/statelib/src/test/java/org/apache/bookkeeper/statelib/testing/executors/MockExecutorController.java index 01489227205..a191f3fd104 100644 --- a/stream/statelib/src/test/java/org/apache/bookkeeper/statelib/testing/executors/MockExecutorController.java +++ b/stream/statelib/src/test/java/org/apache/bookkeeper/statelib/testing/executors/MockExecutorController.java @@ -44,7 +44,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.apache.bookkeeper.common.concurrent.FutureUtils; -import org.junit.Assert; +import org.hamcrest.MatcherAssert; import org.mockito.stubbing.Answer; /** @@ -131,7 +131,7 @@ private void runTask(Runnable runnable) { if (null == executor) { runnable.run(); } else { - Assert.assertThat("calling this on the same thread will result in deadlock", + MatcherAssert.assertThat("calling this on the same thread will result in deadlock", Thread.currentThread().getName(), not(containsString(THREAD_NAME_PREFIX))); executor.submit(runnable).get();