From 2c313dda40311b8f98dd87ba721c2f86dd77e834 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:09:34 +0300 Subject: [PATCH] Update MapperTestCase.java --- .../org/elasticsearch/index/mapper/MapperTestCase.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java b/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java index ee437cee11876..61ffbfe1fee37 100644 --- a/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java @@ -1586,7 +1586,7 @@ public void testSyntheticSourceKeepArrays() throws IOException { b.endObject(); })); - int elementCount = randomIntBetween(1, 5); + int elementCount = randomIntBetween(2, 5); CheckedConsumer buildInput = (XContentBuilder builder) -> { example.buildInputArray(builder, elementCount); }; @@ -1597,10 +1597,7 @@ public void testSyntheticSourceKeepArrays() throws IOException { builder.endObject(); String expected = Strings.toString(builder); String actual = syntheticSource(mapperAll, buildInput); - // Check for single-element array, the array source is not stored in this case. - if (actual.contains("[") && expected.replace("[", "").replace("]", "").equals(actual) == false) { - assertThat(actual, equalTo(expected)); - } + assertThat(actual, equalTo(expected)); } @Override