Skip to content

Commit 38cd668

Browse files
Remove deprecated third-party methods from tests (#55255)
I've noticed that a lot of our tests are using deprecated static methods from the Hamcrest matchers. While this is not a big deal in any objective sense, it seems like a small good thing to reduce compilation warnings and be ready for a new release of the matcher library if we need to upgrade. I've also switched a few other methods in tests that have drop-in replacements.
1 parent 842ce32 commit 38cd668

File tree

56 files changed

+204
-182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+204
-182
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/LicenseIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import static org.hamcrest.CoreMatchers.notNullValue;
5050
import static org.hamcrest.CoreMatchers.nullValue;
5151
import static org.hamcrest.Matchers.empty;
52-
import static org.hamcrest.Matchers.isEmptyOrNullString;
52+
import static org.hamcrest.Matchers.emptyOrNullString;
5353
import static org.hamcrest.Matchers.not;
5454

5555
public class LicenseIT extends ESRestHighLevelClientTestCase {
@@ -167,9 +167,9 @@ public void testStartBasic() throws Exception {
167167
private static void assertNotEmptyAcknowledgeMessages(Map<String, String[]> acknowledgeMessages) {
168168
assertThat(acknowledgeMessages.entrySet(), not(empty()));
169169
for (Map.Entry<String, String[]> entry : acknowledgeMessages.entrySet()) {
170-
assertThat(entry.getKey(), not(isEmptyOrNullString()));
170+
assertThat(entry.getKey(), not(emptyOrNullString()));
171171
for (String message : entry.getValue()) {
172-
assertThat(message, not(isEmptyOrNullString()));
172+
assertThat(message, not(emptyOrNullString()));
173173
}
174174
}
175175
}

client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
9999
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertToXContentEquivalent;
100100
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
101+
import static org.hamcrest.Matchers.arrayContaining;
101102
import static org.hamcrest.Matchers.both;
102103
import static org.hamcrest.Matchers.containsString;
103104
import static org.hamcrest.Matchers.either;
@@ -1227,7 +1228,7 @@ public void testFieldCaps() throws IOException {
12271228
FieldCapabilitiesResponse response = execute(request,
12281229
highLevelClient()::fieldCaps, highLevelClient()::fieldCapsAsync);
12291230

1230-
assertEquals(new String[] {"index1", "index2"}, response.getIndices());
1231+
assertThat(response.getIndices(), arrayContaining("index1", "index2"));
12311232

12321233
// Check the capabilities for the 'rating' field.
12331234
assertTrue(response.get().containsKey("rating"));

client/rest-high-level/src/test/java/org/elasticsearch/client/core/BroadcastResponseTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import static org.hamcrest.Matchers.containsString;
3535
import static org.hamcrest.Matchers.equalTo;
3636
import static org.hamcrest.Matchers.hasSize;
37-
import static org.hamcrest.Matchers.isIn;
37+
import static org.hamcrest.Matchers.in;
3838

3939
public class BroadcastResponseTests extends AbstractResponseTestCase<org.elasticsearch.action.support.broadcast.BroadcastResponse,
4040
BroadcastResponse> {
@@ -80,7 +80,7 @@ protected void assertInstances(org.elasticsearch.action.support.broadcast.Broadc
8080
if (clientInstance.shards().failed() > 0) {
8181
final DefaultShardOperationFailedException groupedFailure = clientInstance.shards().failures().iterator().next();
8282
assertThat(groupedFailure.index(), equalTo(index));
83-
assertThat(groupedFailure.shardId(), isIn(shardIds));
83+
assertThat(groupedFailure.shardId(), in(shardIds));
8484
assertThat(groupedFailure.reason(), containsString("reason=retention lease with ID [" + id + "] not found"));
8585
}
8686
}

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/RollupDocumentationIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
import static org.hamcrest.Matchers.closeTo;
8181
import static org.hamcrest.Matchers.equalTo;
8282
import static org.hamcrest.Matchers.hasSize;
83-
import static org.hamcrest.Matchers.isOneOf;
83+
import static org.hamcrest.Matchers.oneOf;
8484

8585
public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
8686

@@ -429,7 +429,7 @@ public void testGetRollupCaps() throws Exception {
429429
ClusterHealthRequest healthRequest = new ClusterHealthRequest(config.getRollupIndex()).waitForYellowStatus();
430430
ClusterHealthResponse healthResponse = client.cluster().health(healthRequest, RequestOptions.DEFAULT);
431431
assertFalse(healthResponse.isTimedOut());
432-
assertThat(healthResponse.getStatus(), isOneOf(ClusterHealthStatus.YELLOW, ClusterHealthStatus.GREEN));
432+
assertThat(healthResponse.getStatus(), oneOf(ClusterHealthStatus.YELLOW, ClusterHealthStatus.GREEN));
433433

434434
// Now that the job is created, we should have a rollup index with metadata.
435435
// We can test out the caps API now.
@@ -546,7 +546,7 @@ public void testGetRollupIndexCaps() throws Exception {
546546
ClusterHealthRequest healthRequest = new ClusterHealthRequest(config.getRollupIndex()).waitForYellowStatus();
547547
ClusterHealthResponse healthResponse = client.cluster().health(healthRequest, RequestOptions.DEFAULT);
548548
assertFalse(healthResponse.isTimedOut());
549-
assertThat(healthResponse.getStatus(), isOneOf(ClusterHealthStatus.YELLOW, ClusterHealthStatus.GREEN));
549+
assertThat(healthResponse.getStatus(), oneOf(ClusterHealthStatus.YELLOW, ClusterHealthStatus.GREEN));
550550

551551
// Now that the job is created, we should have a rollup index with metadata.
552552
// We can test out the caps API now.

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SecurityDocumentationIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
import static org.hamcrest.Matchers.equalTo;
135135
import static org.hamcrest.Matchers.greaterThan;
136136
import static org.hamcrest.Matchers.hasItem;
137+
import static org.hamcrest.Matchers.in;
137138
import static org.hamcrest.Matchers.is;
138-
import static org.hamcrest.Matchers.isIn;
139139
import static org.hamcrest.Matchers.iterableWithSize;
140140
import static org.hamcrest.Matchers.not;
141141
import static org.hamcrest.Matchers.notNullValue;
@@ -494,7 +494,7 @@ public void testGetRoleMappings() throws Exception {
494494
assertThat(mappings.size(), is(2));
495495
for (ExpressionRoleMapping roleMapping : mappings) {
496496
assertThat(roleMapping.isEnabled(), is(true));
497-
assertThat(roleMapping.getName(), isIn(new String[]{"mapping-example-1", "mapping-example-2"}));
497+
assertThat(roleMapping.getName(), in(new String[]{"mapping-example-1", "mapping-example-2"}));
498498
if (roleMapping.getName().equals("mapping-example-1")) {
499499
assertThat(roleMapping.getMetadata(), equalTo(Collections.emptyMap()));
500500
assertThat(roleMapping.getExpression(), equalTo(rules1));
@@ -519,7 +519,7 @@ public void testGetRoleMappings() throws Exception {
519519
assertThat(mappings.size(), is(2));
520520
for (ExpressionRoleMapping roleMapping : mappings) {
521521
assertThat(roleMapping.isEnabled(), is(true));
522-
assertThat(roleMapping.getName(), isIn(new String[]{"mapping-example-1", "mapping-example-2"}));
522+
assertThat(roleMapping.getName(), in(new String[]{"mapping-example-1", "mapping-example-2"}));
523523
if (roleMapping.getName().equals("mapping-example-1")) {
524524
assertThat(roleMapping.getMetadata(), equalTo(Collections.emptyMap()));
525525
assertThat(roleMapping.getExpression(), equalTo(rules1));

client/rest-high-level/src/test/java/org/elasticsearch/client/indices/ReloadAnalyzersResponseTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import static org.hamcrest.Matchers.containsString;
4040
import static org.hamcrest.Matchers.equalTo;
4141
import static org.hamcrest.Matchers.hasSize;
42-
import static org.hamcrest.Matchers.isIn;
42+
import static org.hamcrest.Matchers.in;
4343

4444
public class ReloadAnalyzersResponseTests
4545
extends AbstractResponseTestCase<org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse, ReloadAnalyzersResponse> {
@@ -94,7 +94,7 @@ protected void assertInstances(org.elasticsearch.xpack.core.action.ReloadAnalyze
9494
if (clientInstance.shards().failed() > 0) {
9595
final DefaultShardOperationFailedException groupedFailure = clientInstance.shards().failures().iterator().next();
9696
assertThat(groupedFailure.index(), equalTo(index));
97-
assertThat(groupedFailure.shardId(), isIn(shardIds));
97+
assertThat(groupedFailure.shardId(), in(shardIds));
9898
assertThat(groupedFailure.reason(), containsString("reason=retention lease with ID [" + id + "] not found"));
9999
}
100100
Map<String, ReloadDetails> serverDetails = serverTestInstance.getReloadDetails();

client/rest/src/test/java/org/elasticsearch/client/HeapBufferedAsyncResponseConsumerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public long getContentLength() {
135135
return contentLength.get();
136136
}
137137
};
138-
contentLength.set(randomLong(bufferLimit));
138+
contentLength.set(randomLongBetween(0L, bufferLimit));
139139
consumer.onEntityEnclosed(entity, ContentType.APPLICATION_JSON);
140140

141141
contentLength.set(randomLongBetween(bufferLimit + 1, MAX_TEST_BUFFER_SIZE));

libs/x-content/src/test/java/org/elasticsearch/common/ParseFieldTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import static org.hamcrest.CoreMatchers.is;
2525
import static org.hamcrest.CoreMatchers.not;
2626
import static org.hamcrest.CoreMatchers.sameInstance;
27-
import static org.hamcrest.collection.IsArrayContainingInAnyOrder.arrayContainingInAnyOrder;
27+
import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
2828

2929
public class ParseFieldTests extends ESTestCase {
3030
public void testParse() {

libs/x-content/src/test/java/org/elasticsearch/common/xcontent/XContentParserTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
import static org.hamcrest.Matchers.containsString;
4242
import static org.hamcrest.Matchers.equalTo;
4343
import static org.hamcrest.Matchers.hasSize;
44+
import static org.hamcrest.Matchers.in;
4445
import static org.hamcrest.Matchers.instanceOf;
45-
import static org.hamcrest.Matchers.isIn;
4646
import static org.hamcrest.Matchers.nullValue;
4747
import static org.junit.internal.matchers.ThrowableMessageMatcher.hasMessage;
4848

@@ -208,7 +208,7 @@ public void testReadBooleansFailsForLenientBooleans() throws IOException {
208208
assertThat(token, equalTo(XContentParser.Token.FIELD_NAME));
209209
assertThat(parser.currentName(), equalTo("foo"));
210210
token = parser.nextToken();
211-
assertThat(token, isIn(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_NUMBER)));
211+
assertThat(token, in(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_NUMBER)));
212212
assertFalse(parser.isBooleanValue());
213213
if (token.equals(XContentParser.Token.VALUE_STRING)) {
214214
expectThrows(IllegalArgumentException.class, parser::booleanValue);
@@ -220,7 +220,7 @@ public void testReadBooleansFailsForLenientBooleans() throws IOException {
220220
assertThat(token, equalTo(XContentParser.Token.FIELD_NAME));
221221
assertThat(parser.currentName(), equalTo("bar"));
222222
token = parser.nextToken();
223-
assertThat(token, isIn(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_NUMBER)));
223+
assertThat(token, in(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_NUMBER)));
224224
assertFalse(parser.isBooleanValue());
225225
if (token.equals(XContentParser.Token.VALUE_STRING)) {
226226
expectThrows(IllegalArgumentException.class, parser::booleanValue);
@@ -241,15 +241,15 @@ public void testReadBooleans() throws IOException {
241241
assertThat(token, equalTo(XContentParser.Token.FIELD_NAME));
242242
assertThat(parser.currentName(), equalTo("foo"));
243243
token = parser.nextToken();
244-
assertThat(token, isIn(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_BOOLEAN)));
244+
assertThat(token, in(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_BOOLEAN)));
245245
assertTrue(parser.isBooleanValue());
246246
assertFalse(parser.booleanValue());
247247

248248
token = parser.nextToken();
249249
assertThat(token, equalTo(XContentParser.Token.FIELD_NAME));
250250
assertThat(parser.currentName(), equalTo("bar"));
251251
token = parser.nextToken();
252-
assertThat(token, isIn(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_BOOLEAN)));
252+
assertThat(token, in(Arrays.asList(XContentParser.Token.VALUE_STRING, XContentParser.Token.VALUE_BOOLEAN)));
253253
assertTrue(parser.isBooleanValue());
254254
assertTrue(parser.booleanValue());
255255
}

modules/lang-mustache/src/test/java/org/elasticsearch/script/mustache/MustacheTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
4444
import static org.hamcrest.Matchers.both;
4545
import static org.hamcrest.Matchers.containsString;
46+
import static org.hamcrest.Matchers.emptyOrNullString;
4647
import static org.hamcrest.Matchers.equalTo;
47-
import static org.hamcrest.Matchers.isEmptyOrNullString;
4848
import static org.hamcrest.Matchers.not;
4949

5050
public class MustacheTests extends ESTestCase {
@@ -384,7 +384,7 @@ private void assertScript(String script, Map<String, Object> vars, Matcher<Strin
384384
}
385385

386386
private TemplateScript.Factory compile(String script) {
387-
assertThat("cannot compile null or empty script", script, not(isEmptyOrNullString()));
387+
assertThat("cannot compile null or empty script", script, not(emptyOrNullString()));
388388
return engine.compile(null, script, TemplateScript.CONTEXT, Collections.emptyMap());
389389
}
390390
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/SearchAsYouTypeFieldMapperTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070

7171
import static java.util.Arrays.asList;
7272
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasProperty;
73+
import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
7374
import static org.hamcrest.Matchers.containsInAnyOrder;
7475
import static org.hamcrest.Matchers.containsString;
7576
import static org.hamcrest.Matchers.equalTo;
7677
import static org.hamcrest.Matchers.hasSize;
7778
import static org.hamcrest.Matchers.notNullValue;
78-
import static org.hamcrest.collection.IsArrayContainingInAnyOrder.arrayContainingInAnyOrder;
7979
import static org.hamcrest.core.IsInstanceOf.instanceOf;
8080

8181
public class SearchAsYouTypeFieldMapperTests extends ESSingleNodeTestCase {

plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
import static org.hamcrest.Matchers.containsInAnyOrder;
4242
import static org.hamcrest.Matchers.containsString;
4343
import static org.hamcrest.Matchers.equalTo;
44+
import static org.hamcrest.Matchers.hasItem;
4445
import static org.hamcrest.Matchers.hasSize;
4546
import static org.hamcrest.Matchers.is;
4647
import static org.hamcrest.Matchers.not;
4748
import static org.hamcrest.Matchers.notNullValue;
4849
import static org.hamcrest.Matchers.nullValue;
49-
import static org.hamcrest.core.IsCollectionContaining.hasItem;
5050

5151
public class AttachmentProcessorTests extends ESTestCase {
5252

plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureStorageServiceTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242

4343
import static org.elasticsearch.repositories.azure.AzureStorageService.blobNameFromUri;
4444
import static org.hamcrest.Matchers.containsInAnyOrder;
45+
import static org.hamcrest.Matchers.emptyString;
4546
import static org.hamcrest.Matchers.equalTo;
4647
import static org.hamcrest.Matchers.instanceOf;
4748
import static org.hamcrest.Matchers.is;
48-
import static org.hamcrest.Matchers.isEmptyString;
4949
import static org.hamcrest.Matchers.notNullValue;
5050
import static org.hamcrest.Matchers.nullValue;
5151

@@ -58,8 +58,8 @@ public void testReadSecuredSettings() {
5858
final Map<String, AzureStorageSettings> loadedSettings = AzureStorageSettings.load(settings);
5959
assertThat(loadedSettings.keySet(), containsInAnyOrder("azure1","azure2","azure3","default"));
6060

61-
assertThat(loadedSettings.get("azure1").getEndpointSuffix(), isEmptyString());
62-
assertThat(loadedSettings.get("azure2").getEndpointSuffix(), isEmptyString());
61+
assertThat(loadedSettings.get("azure1").getEndpointSuffix(), is(emptyString()));
62+
assertThat(loadedSettings.get("azure2").getEndpointSuffix(), is(emptyString()));
6363
assertThat(loadedSettings.get("azure3").getEndpointSuffix(), equalTo("my_endpoint_suffix"));
6464
}
6565

plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import java.util.Map;
3131

3232
import static org.hamcrest.Matchers.contains;
33+
import static org.hamcrest.Matchers.emptyString;
3334
import static org.hamcrest.Matchers.is;
34-
import static org.hamcrest.Matchers.isEmptyString;
3535
import static org.hamcrest.Matchers.nullValue;
3636

3737
public class S3ClientSettingsTests extends ESTestCase {
@@ -41,12 +41,12 @@ public void testThereIsADefaultClientByDefault() {
4141

4242
final S3ClientSettings defaultSettings = settings.get("default");
4343
assertThat(defaultSettings.credentials, nullValue());
44-
assertThat(defaultSettings.endpoint, isEmptyString());
44+
assertThat(defaultSettings.endpoint, is(emptyString()));
4545
assertThat(defaultSettings.protocol, is(Protocol.HTTPS));
46-
assertThat(defaultSettings.proxyHost, isEmptyString());
46+
assertThat(defaultSettings.proxyHost, is(emptyString()));
4747
assertThat(defaultSettings.proxyPort, is(80));
48-
assertThat(defaultSettings.proxyUsername, isEmptyString());
49-
assertThat(defaultSettings.proxyPassword, isEmptyString());
48+
assertThat(defaultSettings.proxyUsername, is(emptyString()));
49+
assertThat(defaultSettings.proxyPassword, is(emptyString()));
5050
assertThat(defaultSettings.readTimeoutMillis, is(ClientConfiguration.DEFAULT_SOCKET_TIMEOUT));
5151
assertThat(defaultSettings.maxRetries, is(ClientConfiguration.DEFAULT_RETRY_POLICY.getMaxErrorRetry()));
5252
assertThat(defaultSettings.throttleRetries, is(ClientConfiguration.DEFAULT_THROTTLE_RETRIES));

qa/evil-tests/src/test/java/org/elasticsearch/cli/EvilCommandTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
import java.util.concurrent.atomic.AtomicBoolean;
2727

2828
import static org.hamcrest.CoreMatchers.containsString;
29-
import static org.hamcrest.Matchers.isEmptyString;
29+
import static org.hamcrest.Matchers.emptyString;
30+
import static org.hamcrest.Matchers.is;
3031

3132
public class EvilCommandTests extends ESTestCase {
3233

@@ -62,7 +63,7 @@ public void close() throws IOException {
6263
// ensure that we dump the stack trace too
6364
assertThat(output, containsString("\tat org.elasticsearch.cli.EvilCommandTests$1.close"));
6465
} else {
65-
assertThat(output, isEmptyString());
66+
assertThat(output, is(emptyString()));
6667
}
6768
}
6869

qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
import static org.hamcrest.CoreMatchers.equalTo;
5151
import static org.hamcrest.CoreMatchers.is;
5252
import static org.hamcrest.CoreMatchers.not;
53-
import static org.hamcrest.Matchers.isEmptyString;
53+
import static org.hamcrest.Matchers.emptyString;
5454
import static org.hamcrest.Matchers.startsWith;
5555
import static org.junit.Assume.assumeThat;
5656
import static org.junit.Assume.assumeTrue;
@@ -71,7 +71,7 @@ public void test20PluginsListWithNoPlugins() throws Exception {
7171
final Installation.Executables bin = installation.executables();
7272
final Result r = bin.pluginTool.run("list");
7373

74-
assertThat(r.stdout, isEmptyString());
74+
assertThat(r.stdout, emptyString());
7575
}
7676

7777
public void test30MissingBundledJdk() throws Exception {

qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
import static org.elasticsearch.cluster.routing.allocation.decider.MaxRetryAllocationDecider.SETTING_ALLOCATION_MAX_RETRY;
5454
import static org.hamcrest.Matchers.equalTo;
5555
import static org.hamcrest.Matchers.hasSize;
56+
import static org.hamcrest.Matchers.in;
5657
import static org.hamcrest.Matchers.is;
57-
import static org.hamcrest.Matchers.isIn;
5858
import static org.hamcrest.Matchers.notNullValue;
5959
import static org.hamcrest.Matchers.nullValue;
6060
import static org.hamcrest.Matchers.oneOf;
@@ -252,7 +252,7 @@ public void testRelocationWithConcurrentIndexing() throws Exception {
252252
String xpath = "routing_table.indices." + index + ".shards.0.node";
253253
@SuppressWarnings("unchecked") List<String> assignedNodes = (List<String>) XContentMapValues.extractValue(xpath, state);
254254
assertNotNull(state.toString(), assignedNodes);
255-
assertThat(state.toString(), newNode, isIn(assignedNodes));
255+
assertThat(state.toString(), newNode, in(assignedNodes));
256256
}, 60, TimeUnit.SECONDS);
257257
ensureGreen(index);
258258
client().performRequest(new Request("POST", index + "/_refresh"));

0 commit comments

Comments
 (0)