Skip to content

Commit 2e7fa50

Browse files
Use ArgumentMatchers.any()
1 parent 7511df2 commit 2e7fa50

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

server/src/test/java/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
5353
import static org.hamcrest.Matchers.not;
5454
import static org.mockito.ArgumentMatchers.any;
55-
import static org.mockito.ArgumentMatchers.argThat;
5655
import static org.mockito.Mockito.mock;
5756
import static org.mockito.Mockito.times;
5857
import static org.mockito.Mockito.verify;
@@ -133,7 +132,7 @@ public void testReturnsOnlyRequestedStats() throws Exception {
133132
)) {
134133
var request = new TransportGetAllocationStatsAction.Request(TimeValue.ONE_MINUTE, TaskId.EMPTY_TASK_ID, metrics);
135134

136-
when(allocationStatsService.stats(argThat(r -> true))).thenReturn(
135+
when(allocationStatsService.stats(any())).thenReturn(
137136
Map.of(randomIdentifier(), NodeAllocationStatsTests.randomNodeAllocationStats())
138137
);
139138

@@ -161,7 +160,7 @@ public void testDeduplicatesStatsComputations() throws InterruptedException {
161160
disableAllocationStatsCache();
162161
final var requestCounter = new AtomicInteger();
163162
final var isExecuting = new AtomicBoolean();
164-
when(allocationStatsService.stats(argThat(r -> true))).thenAnswer(invocation -> {
163+
when(allocationStatsService.stats(any())).thenAnswer(invocation -> {
165164
try {
166165
assertTrue(isExecuting.compareAndSet(false, true));
167166
assertThat(Thread.currentThread().getName(), containsString("[management]"));
@@ -262,7 +261,7 @@ public void testGetStatsWithCachingEnabled() throws Exception {
262261
final Runnable resetExpectedAllocationStats = () -> {
263262
final var stats = Map.of(randomIdentifier(), NodeAllocationStatsTests.randomNodeAllocationStats());
264263
allocationStats.set(stats);
265-
when(allocationStatsService.stats(argThat(r -> true))).thenReturn(stats);
264+
when(allocationStatsService.stats(any())).thenReturn(stats);
266265
};
267266

268267
final CheckedConsumer<ActionListener<Void>, Exception> threadTask = l -> {

0 commit comments

Comments
 (0)