Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use MatcherAssert.assertThat instead to replace deprecated method #4493

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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