From e62aaa928efebf20e40b0e3f83d563e2f41555d3 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Fri, 24 Jul 2015 17:59:36 +0200 Subject: [PATCH] Tests: Fix TermVectorsUnitTests to not rely on HashMap iteration order. --- .../action/termvectors/TermVectorsUnitTests.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java b/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java index 49f896c748d..d48473d8507 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java @@ -49,6 +49,7 @@ import org.junit.Test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.util.Arrays; import java.util.EnumSet; import java.util.HashSet; import java.util.Set; @@ -335,11 +336,11 @@ public class TermVectorsUnitTests extends ElasticsearchTestCase { } void checkParsedFilterParameters(MultiTermVectorsRequest multiRequest) { - int id = 1; + Set ids = new HashSet<>(Arrays.asList("1", "2")); for (TermVectorsRequest request : multiRequest.requests) { assertThat(request.index(), equalTo("testidx")); assertThat(request.type(), equalTo("test")); - assertThat(request.id(), equalTo(id+"")); + assertTrue(ids.remove(request.id())); assertNotNull(request.filterSettings()); assertThat(request.filterSettings().maxNumTerms, equalTo(20)); assertThat(request.filterSettings().minTermFreq, equalTo(1)); @@ -348,7 +349,7 @@ public class TermVectorsUnitTests extends ElasticsearchTestCase { assertThat(request.filterSettings().maxDocFreq, equalTo(20)); assertThat(request.filterSettings().minWordLength, equalTo(1)); assertThat(request.filterSettings().maxWordLength, equalTo(20)); - id++; } + assertTrue(ids.isEmpty()); } }