Skip to content

Commit 2de1e7b

Browse files
committed
[Test] Correct matcher for matching single element
1 parent ad2c88e commit 2de1e7b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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
@@ -2750,8 +2750,8 @@ public void testGetServiceAccountCredentials() throws IOException {
27502750
// Cannot assert exactly one token because there are rare occasions where tests overlap and it will see
27512751
// token created from other tests
27522752
assertThat(serviceTokenInfos.size(), greaterThanOrEqualTo(1));
2753-
assertThat(serviceTokenInfos.stream().map(ServiceTokenInfo::getName).collect(Collectors.toSet()), contains("token2"));
2754-
assertThat(serviceTokenInfos.stream().map(ServiceTokenInfo::getSource).collect(Collectors.toSet()), contains("index"));
2753+
assertThat(serviceTokenInfos.stream().map(ServiceTokenInfo::getName).collect(Collectors.toSet()), hasItem("token2"));
2754+
assertThat(serviceTokenInfos.stream().map(ServiceTokenInfo::getSource).collect(Collectors.toSet()), hasItem("index"));
27552755
}
27562756

27572757
{
@@ -2785,7 +2785,7 @@ public void onFailure(Exception e) {
27852785
assertThat(future.actionGet().getPrincipal(), equalTo("elastic/fleet-server"));
27862786
assertThat(future.actionGet().getServiceTokenInfos().size(), greaterThanOrEqualTo(1));
27872787
assertThat(future.actionGet().getServiceTokenInfos().stream().map(ServiceTokenInfo::getName).collect(Collectors.toSet()),
2788-
contains("token2"));
2788+
hasItem("token2"));
27892789
}
27902790
}
27912791

0 commit comments

Comments
 (0)