Unmute and fix testSubParserArray
testSubParserArray failed, fixed and improved to not always have an
object as outer-level inside array.
Closes
@@ -405,7 +405,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();
@@ -419,7 +419,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());
