use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class JsonParser_Test method parse_failsOnTooDeeplyNestedMixedObject.
@Test
public void parse_failsOnTooDeeplyNestedMixedObject() {
JsonValue value = new JsonObject();
for (int i = 0; i < 1001; i++) {
value = i % 2 == 0 ? new JsonArray().add(value) : new JsonObject().add("foo", value);
}
final String input = value.toString();
ParseException exception = assertException(ParseException.class, new RunnableEx() {
public void run() throws IOException {
parser.parse(input);
}
});
assertEquals("Nesting too deep at 1:4002", exception.getMessage());
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class TimedMemberStateTest method testSerialization.
@Test
public void testSerialization() {
JsonObject serialized = timedMemberState.toJson();
TimedMemberState deserialized = new TimedMemberState();
deserialized.fromJson(serialized);
assertNotNull(deserialized);
assertEquals("ClusterName", deserialized.getClusterName());
assertEquals(1827731, deserialized.getTime());
assertNotNull(deserialized.getMemberState());
assertTrue(deserialized.isSslEnabled());
assertTrue(deserialized.isLite());
assertFalse(deserialized.isScriptingEnabled());
assertFalse(deserialized.isConsoleEnabled());
assertTrue(deserialized.isMcDataAccessEnabled());
assertNotNull(deserialized.toString());
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class PrettyPrint_Test method testIndentWithSpaces_nestedObject.
@Test
public void testIndentWithSpaces_nestedObject() throws IOException {
new JsonObject().add("a", 23).add("b", new JsonObject().add("c", 42)).writeTo(output, indentWithSpaces(2));
assertEquals("{\n \"a\": 23,\n \"b\": {\n \"c\": 42\n }\n}", output.toString());
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class PrettyPrint_Test method testIndentWithSpaces_emptyObject.
@Test
public void testIndentWithSpaces_emptyObject() throws IOException {
new JsonObject().writeTo(output, indentWithSpaces(2));
assertEquals("{\n \n}", output.toString());
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class PrettyPrint_Test method testSingleLine_nestedObject.
@Test
public void testSingleLine_nestedObject() throws IOException {
new JsonObject().add("a", 23).add("b", new JsonObject().add("c", 42)).writeTo(output, singleLine());
assertEquals("{\"a\": 23, \"b\": {\"c\": 42}}", output.toString());
}
Aggregations