Search in sources :

Example 1 with Location

use of com.hazelcast.internal.json.Location in project hazelcast by hazelcast.

the class JsonParser_Test method parse_handlesPositionsCorrectlyWhenInputExceedsBufferSize.

@Test
public void parse_handlesPositionsCorrectlyWhenInputExceedsBufferSize() {
    final String input = "{\n  \"a\": 23,\n  \"b\": 42,\n}";
    ParseException exception = assertException(ParseException.class, new RunnableEx() {

        public void run() throws IOException {
            parser.parse(new StringReader(input), 3);
        }
    });
    assertEquals(new Location(24, 4, 1), exception.getLocation());
}
Also used : StringReader(java.io.StringReader) RunnableEx(com.hazelcast.internal.json.TestUtil.RunnableEx) ParseException(com.hazelcast.internal.json.ParseException) IOException(java.io.IOException) Location(com.hazelcast.internal.json.Location) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

Location (com.hazelcast.internal.json.Location)1 ParseException (com.hazelcast.internal.json.ParseException)1 RunnableEx (com.hazelcast.internal.json.TestUtil.RunnableEx)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 Test (org.junit.Test)1