diff --git a/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/XContentParserTests.java b/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/XContentParserTests.java index e98f1e3d585..606d019f3c4 100644 --- a/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/XContentParserTests.java +++ b/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/XContentParserTests.java @@ -376,7 +376,7 @@ public class XContentParserTests extends ESTestCase { builder.startArray(); int numberOfTokens = 0; for (int i = 0; i < numberOfArrayElements; ++i) { - numberOfTokens += generateRandomObjectForMarking(builder); + numberOfTokens += generateRandomObject(builder, 0); } builder.endArray(); builder.endObject(); @@ -390,7 +390,7 @@ public class XContentParserTests extends ESTestCase { assertEquals(XContentParser.Token.START_ARRAY, parser.nextToken()); // [ XContentParser subParser = new XContentSubParser(parser); try { - int tokensToSkip = randomInt(numberOfTokens - 1); + int tokensToSkip = randomInt(numberOfTokens); for (int i = 0; i < tokensToSkip; i++) { // Simulate incomplete parsing assertNotNull(subParser.nextToken());