use of com.yahoo.data.access.Inspector in project vespa by vespa-engine.
the class JSONStringTestCase method testArrayOfArray.
@Test
public void testArrayOfArray() {
String json = "[[\"c1\", 0], [\"c2\", 2, 3], [\"c3\", 3, 4, 5], [\"c4\", 4,5,6,7]]";
JSONString js = new JSONString(json);
Inspector outer = js.inspect();
assertEquals(4, outer.entryCount());
assertEquals(2, outer.entry(0).entryCount());
assertEquals("c1", outer.entry(0).entry(0).asString());
assertEquals(0, outer.entry(0).entry(1).asLong());
assertEquals(3, outer.entry(1).entryCount());
assertEquals("c2", outer.entry(1).entry(0).asString());
assertEquals(2, outer.entry(1).entry(1).asLong());
assertEquals(3, outer.entry(1).entry(2).asLong());
assertEquals(4, outer.entry(2).entryCount());
assertEquals("c3", outer.entry(2).entry(0).asString());
assertEquals(3, outer.entry(2).entry(1).asLong());
assertEquals(4, outer.entry(2).entry(2).asLong());
assertEquals(5, outer.entry(2).entry(3).asLong());
assertEquals(5, outer.entry(3).entryCount());
assertEquals("c4", outer.entry(3).entry(0).asString());
assertEquals(4, outer.entry(3).entry(1).asLong());
assertEquals(5, outer.entry(3).entry(2).asLong());
assertEquals(6, outer.entry(3).entry(3).asLong());
assertEquals(7, outer.entry(3).entry(4).asLong());
}
Aggregations