use of com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper in project jackson-core by FasterXML.
the class AsyncMissingValuesInObjectTest method createParser.
private AsyncReaderWrapper createParser(JsonFactory f, String doc) throws IOException {
// should vary but...
int bytesPerRead = 3;
AsyncReaderWrapper p = asyncForBytes(f, bytesPerRead, _jsonDoc(doc), 0);
return p;
}
use of com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper in project jackson-core by FasterXML.
the class AsyncMissingValuesInObjectTest method testObjectLeadingComma.
@Test
public void testObjectLeadingComma() throws Exception {
String json = "{,\"a\": true, \"b\": false}";
AsyncReaderWrapper p = createParser(factory, json);
assertEquals(JsonToken.START_OBJECT, p.nextToken());
assertUnexpected(p, ',');
p.close();
}
use of com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper in project jackson-core by FasterXML.
the class AsyncNonStdParsingTest method _testLargeUnquoted.
private void _testLargeUnquoted(JsonFactory f, int reps, String doc, int offset, int readSize) throws Exception {
AsyncReaderWrapper p = createParser(f, doc, offset, readSize);
assertToken(JsonToken.START_ARRAY, p.nextToken());
for (int i = 0; i < reps; ++i) {
assertToken(JsonToken.START_OBJECT, p.nextToken());
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertEquals("abc" + (i & 127), p.currentName());
assertToken(((i & 1) != 0) ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE, p.nextToken());
assertToken(JsonToken.END_OBJECT, p.nextToken());
}
assertToken(JsonToken.END_ARRAY, p.nextToken());
p.close();
}
use of com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper in project jackson-core by FasterXML.
the class AsyncNonStdParsingTest method _testSingleQuotesEscaped.
private void _testSingleQuotesEscaped(JsonFactory f, int offset, int readSize) throws Exception {
String JSON = "[ '16\\'' ]";
AsyncReaderWrapper p = createParser(f, JSON, offset, readSize);
assertToken(JsonToken.START_ARRAY, p.nextToken());
assertToken(JsonToken.VALUE_STRING, p.nextToken());
assertEquals("16'", p.currentText());
assertToken(JsonToken.END_ARRAY, p.nextToken());
p.close();
}
use of com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper in project jackson-core by FasterXML.
the class AsyncNonStdParsingTest method _testNonStandardNameChars.
private void _testNonStandardNameChars(JsonFactory f, int offset, int readSize) throws Exception {
String JSON = "{ @type : \"mytype\", #color : 123, *error* : true, " + " hyphen-ated : \"yes\", me+my : null" + "}";
AsyncReaderWrapper p = createParser(f, JSON, offset, readSize);
assertToken(JsonToken.START_OBJECT, p.nextToken());
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertEquals("@type", p.currentText());
assertToken(JsonToken.VALUE_STRING, p.nextToken());
assertEquals("mytype", p.currentText());
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertEquals("#color", p.currentText());
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
assertEquals(123, p.getIntValue());
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertEquals("*error*", p.currentText());
assertToken(JsonToken.VALUE_TRUE, p.nextToken());
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertEquals("hyphen-ated", p.currentText());
assertToken(JsonToken.VALUE_STRING, p.nextToken());
assertEquals("yes", p.currentText());
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertEquals("me+my", p.currentText());
assertToken(JsonToken.VALUE_NULL, p.nextToken());
assertToken(JsonToken.END_OBJECT, p.nextToken());
p.close();
}
Aggregations