summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/common
diff options
context:
space:
mode:
authorTanguy Leroux <tlrx.dev@gmail.com>2017-05-03 13:27:20 +0200
committerGitHub <noreply@github.com>2017-05-03 13:27:20 +0200
commit2ac90b3de96b375e4fb61035eb6679917e7c017d (patch)
treedcbf3c4a662913af9bf52ce0e12ec38c24e62148 /core/src/test/java/org/elasticsearch/common
parentfbd793d9e677f989296549f3545f7e0b1e5f4f26 (diff)
Add parsing methods for InternalDateHistogram and InternalHistogram (#24213)
Diffstat (limited to 'core/src/test/java/org/elasticsearch/common')
-rw-r--r--core/src/test/java/org/elasticsearch/common/xcontent/XContentParserUtilsTests.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/src/test/java/org/elasticsearch/common/xcontent/XContentParserUtilsTests.java b/core/src/test/java/org/elasticsearch/common/xcontent/XContentParserUtilsTests.java
index d0426e1e10..4b90016eaa 100644
--- a/core/src/test/java/org/elasticsearch/common/xcontent/XContentParserUtilsTests.java
+++ b/core/src/test/java/org/elasticsearch/common/xcontent/XContentParserUtilsTests.java
@@ -65,12 +65,10 @@ public class XContentParserUtilsTests extends ESTestCase {
BytesReference bytes = toXContent((builder, params) -> builder.field("test", 0), xContentType, randomBoolean());
try (XContentParser parser = xContentType.xContent().createParser(namedXContentRegistry, bytes)) {
- parser.nextToken();
- ParsingException e = expectThrows(ParsingException.class, () -> parseTypedKeysObject(parser, delimiter, Boolean.class));
- assertEquals("Failed to parse object: expecting token of type [FIELD_NAME] but found [START_OBJECT]", e.getMessage());
+ ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation);
+ ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.nextToken(), parser::getTokenLocation);
- parser.nextToken();
- e = expectThrows(ParsingException.class, () -> parseTypedKeysObject(parser, delimiter, Boolean.class));
+ ParsingException e = expectThrows(ParsingException.class, () -> parseTypedKeysObject(parser, delimiter, Boolean.class));
assertEquals("Cannot parse object of class [Boolean] without type information. Set [typed_keys] parameter " +
"on the request to ensure the type information is added to the response output", e.getMessage());
}