use of com.fasterxml.jackson.core.util.BufferRecycler in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method test_parseAposNameThrowsEOFException.
@Test
public void test_parseAposNameThrowsEOFException() throws IOException {
IOContext ioContext = new IOContext(new BufferRecycler(), this, false);
byte[] byteArray = new byte[17];
byteArray[4] = (byte) 43;
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
ByteQuadsCanonicalizer byteQuadsCanonicalizer = ByteQuadsCanonicalizer.createRoot();
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 42, dataInputStream, byteQuadsCanonicalizer, 0);
try {
uTF8DataInputJsonParser._parseAposName();
fail("Expecting exception: EOFException");
} catch (EOFException e) {
assertEquals(DataInputStream.class.getName(), e.getStackTrace()[0].getClassName());
}
}
use of com.fasterxml.jackson.core.util.BufferRecycler in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method testGetNextFieldNameAndGetTextLength.
@Test
public void testGetNextFieldNameAndGetTextLength() throws IOException {
byte[] byteArray = new byte[2];
byteArray[1] = (byte) 91;
IOContext ioContext = new IOContext(new BufferRecycler(), byteArray, false);
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 42, dataInputStream, ByteQuadsCanonicalizer.createRoot(), 0);
uTF8DataInputJsonParser.nextFieldName();
assertNull(uTF8DataInputJsonParser.getObjectId());
assertEquals(1, uTF8DataInputJsonParser.getTextLength());
}
use of com.fasterxml.jackson.core.util.BufferRecycler in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method test_parsePosNumber.
@Test
public void test_parsePosNumber() throws IOException {
byte[] byteArray = new byte[2];
byteArray[0] = (byte) 51;
byteArray[1] = (byte) 22;
IOContext ioContext = new IOContext(new BufferRecycler(), byteArray, false);
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
ByteQuadsCanonicalizer byteQuadsCanonicalizer = ByteQuadsCanonicalizer.createRoot();
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 1568, dataInputStream, byteQuadsCanonicalizer, 13);
JsonToken jsonToken = uTF8DataInputJsonParser._parsePosNumber(7);
assertEquals(7, jsonToken.id());
assertNull(jsonToken.asString());
}
use of com.fasterxml.jackson.core.util.BufferRecycler in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method test_parseNegNumberThrowsIOException.
@Test
public void test_parseNegNumberThrowsIOException() throws IOException {
IOContext ioContext = new IOContext(new BufferRecycler(), this, false);
byte[] byteArray = new byte[20];
byteArray[2] = (byte) 73;
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 100, dataInputStream, null, 3);
dataInputStream.readUnsignedShort();
try {
uTF8DataInputJsonParser._parseNegNumber();
fail("Expecting exception: IOException");
} catch (IOException e) {
assertEquals(JsonParser.class.getName(), e.getStackTrace()[0].getClassName());
}
}
use of com.fasterxml.jackson.core.util.BufferRecycler in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method testNextFieldNameThrowsIOException.
@Test
public void testNextFieldNameThrowsIOException() {
IOContext ioContext = new IOContext(new BufferRecycler(), this, false);
byte[] byteArray = new byte[20];
byteArray[0] = (byte) 47;
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 100, dataInputStream, null, -2624);
try {
uTF8DataInputJsonParser.nextFieldName();
fail("Expecting exception: IOException");
} catch (IOException e) {
assertEquals(JsonParser.class.getName(), e.getStackTrace()[0].getClassName());
}
}
Aggregations