Search in sources :

Example 26 with BufferRecycler

use of com.fasterxml.jackson.core.util.BufferRecycler in project jackson-core by FasterXML.

the class UTF8DataInputJsonParserTest method testNextTextValueThrowsIOException.

@Test
public void testNextTextValueThrowsIOException() {
    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, 915, dataInputStream, null, (byte) 47);
    try {
        uTF8DataInputJsonParser.nextTextValue();
        fail("Expecting exception: IOException");
    } catch (IOException e) {
        assertEquals(JsonParser.class.getName(), e.getStackTrace()[0].getClassName());
    }
}
Also used : BufferRecycler(com.fasterxml.jackson.core.util.BufferRecycler) IOContext(com.fasterxml.jackson.core.io.IOContext) BaseTest(com.fasterxml.jackson.core.BaseTest) Test(org.junit.Test)

Aggregations

BufferRecycler (com.fasterxml.jackson.core.util.BufferRecycler)26 IOContext (com.fasterxml.jackson.core.io.IOContext)23 Test (org.junit.Test)16 BaseTest (com.fasterxml.jackson.core.BaseTest)15 ByteQuadsCanonicalizer (com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer)7 UTF8Writer (com.fasterxml.jackson.core.io.UTF8Writer)5 ByteArrayBuilder (com.fasterxml.jackson.core.util.ByteArrayBuilder)2 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 JsonToken (com.fasterxml.jackson.core.JsonToken)1 MergedStream (com.fasterxml.jackson.core.io.MergedStream)1 SegmentedStringWriter (com.fasterxml.jackson.core.io.SegmentedStringWriter)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1