This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new d107f66aa8 chore: use MatcherAssert.assertThat instead to replace
deprecated method (#4493)
d107f66aa8 is described below
commit d107f66aa8b05119fb026952346c6ab34bc7b8e5
Author: ZhangJian He <[email protected]>
AuthorDate: Thu Aug 29 07:08:53 2024 +0800
chore: use MatcherAssert.assertThat instead to replace deprecated method
(#4493)
Signed-off-by: ZhangJian He <[email protected]>
---
.../org/apache/bookkeeper/proto/BookieBackpressureTest.java | 12 ++++++------
.../statelib/testing/executors/MockExecutorController.java | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
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 1fe7c3ddbf..a0d81d708d 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.LedgerEntry;
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 class BookieBackpressureTest extends
BookKeeperClusterTestCase
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 class BookieBackpressureTest extends
BookKeeperClusterTestCase
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 @@ public class BookieBackpressureTest extends
BookKeeperClusterTestCase
// 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 @@ public class BookieBackpressureTest extends
BookKeeperClusterTestCase
// 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 0148922720..a191f3fd10 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.Data;
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 @@ public class MockExecutorController {
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();