diff --git a/watcher/src/test/java/org/elasticsearch/watcher/support/text/xmustache/XMustacheTests.java b/watcher/src/test/java/org/elasticsearch/watcher/support/text/xmustache/XMustacheTests.java index 5d421a2e4ee..2188b9e06b6 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/support/text/xmustache/XMustacheTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/support/text/xmustache/XMustacheTests.java @@ -94,14 +94,22 @@ public class XMustacheTests extends ESTestCase { Map vars = new HashMap<>(); Object data = randomFrom( new Map[] { ImmutableMap.of("key", "foo"), ImmutableMap.of("key", "bar") }, - Arrays.asList(ImmutableMap.of("key", "foo"), ImmutableMap.of("key", "bar")), - newHashSet(ImmutableMap.of("key", "foo"), ImmutableMap.of("key", "bar"))); + Arrays.asList(ImmutableMap.of("key", "foo"), ImmutableMap.of("key", "bar"))); vars.put("data", data); Object output = engine.execute(mustache, vars); assertThat(output, notNullValue()); assertThat(output, instanceOf(BytesReference.class)); BytesReference bytes = (BytesReference) output; assertThat(bytes.toUtf8(), equalTo("foo bar")); + + // HashSet iteration order isn't fixed + vars.put("data", newHashSet(ImmutableMap.of("key", "foo"), ImmutableMap.of("key", "bar"))); + output = engine.execute(mustache, vars); + assertThat(output, notNullValue()); + assertThat(output, instanceOf(BytesReference.class)); + bytes = (BytesReference) output; + assertThat(bytes.toUtf8(), both(containsString("foo")).and(containsString("bar"))); + } @Test