Skip to content

Commit

Permalink
chore: use MatcherAssert.assertThat instead to replace deprecated met…
Browse files Browse the repository at this point in the history
…hod (#4493)

Signed-off-by: ZhangJian He <[email protected]>
  • Loading branch information
shoothzj committed Aug 28, 2024
1 parent 4936d39 commit d107f66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d107f66

Please sign in to comment.