use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class JsonParser_Test method parse_failsOnTooDeeplyNestedArray.
@Test
public void parse_failsOnTooDeeplyNestedArray() {
JsonArray array = new JsonArray();
for (int i = 0; i < 1001; i++) {
array = new JsonArray().add(array);
}
final String input = array.toString();
ParseException exception = assertException(ParseException.class, new RunnableEx() {
public void run() throws IOException {
parser.parse(input);
}
});
assertEquals("Nesting too deep at 1:1002", exception.getMessage());
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class JsonParser_Test method parse_doesNotFailWithManyArrays.
@Test
public void parse_doesNotFailWithManyArrays() {
JsonArray array = new JsonArray();
for (int i = 0; i < 1001; i++) {
array.add(new JsonArray().add(7));
}
final String input = array.toString();
JsonValue result = parse(input);
assertTrue(result.isArray());
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class Json_Test method array_double.
@Test
public void array_double() {
assertEquals(new JsonArray().add(3.14d), Json.array(3.14d));
assertEquals(new JsonArray().add(3.14d).add(1.41d), Json.array(3.14d, 1.41d));
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class Json_Test method array_float.
@Test
public void array_float() {
assertEquals(new JsonArray().add(3.14f), Json.array(new float[] { 3.14f }));
assertEquals(new JsonArray().add(3.14f).add(1.41f), Json.array(new float[] { 3.14f, 1.41f }));
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class Json_Test method array_string.
@Test
public void array_string() {
assertEquals(new JsonArray().add("foo"), Json.array("foo"));
assertEquals(new JsonArray().add("foo").add("bar"), Json.array("foo", "bar"));
}
Aggregations