Skip to content

Commit caea845

Browse files
committed
fix test when get both templates
1 parent 7aa8107 commit caea845

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractRawValues;
9292
import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractValue;
9393
import static org.hamcrest.CoreMatchers.hasItem;
94+
import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
9495
import static org.hamcrest.Matchers.contains;
9596
import static org.hamcrest.Matchers.containsString;
9697
import static org.hamcrest.Matchers.equalTo;
@@ -1045,10 +1046,8 @@ public void testGetIndexTemplate() throws Exception {
10451046
}
10461047
GetIndexTemplatesResponse getBoth = execute(getBothRequest, client.indices()::getTemplates, client.indices()::getTemplatesAsync);
10471048
assertThat(getBoth.getIndexTemplates(), hasSize(2));
1048-
assertThat(getBoth.getIndexTemplates().get(0).name(), equalTo("template-1"));
1049-
assertThat(getBoth.getIndexTemplates().get(0).patterns(), contains("pattern-1", "name-1"));
1050-
assertThat(getBoth.getIndexTemplates().get(1).name(), equalTo("template-2"));
1051-
assertThat(getBoth.getIndexTemplates().get(1).patterns(), contains("pattern-2", "name-2"));
1049+
assertThat(getBoth.getIndexTemplates().stream().map(IndexTemplateMetaData::getName).toArray(),
1050+
arrayContainingInAnyOrder("template-1", "template-2"));
10521051

10531052
ElasticsearchException notFound = expectThrows(ElasticsearchException.class, () -> execute(
10541053
new GetIndexTemplatesRequest().names("the-template-*"), client.indices()::getTemplates, client.indices()::getTemplatesAsync));

0 commit comments

Comments
 (0)