Search in sources :

Example 56 with JsonArray

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

the class Json_Test method array_int.

@Test
public void array_int() {
    assertEquals(new JsonArray().add(23), Json.array(new int[] { 23 }));
    assertEquals(new JsonArray().add(23).add(42), Json.array(new int[] { 23, 42 }));
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 57 with JsonArray

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

the class Json_Test method array_boolean.

@Test
public void array_boolean() {
    assertEquals(new JsonArray().add(true), Json.array(true));
    assertEquals(new JsonArray().add(true).add(false), Json.array(true, false));
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 58 with JsonArray

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

the class PrettyPrint_Test method testIndentWithSpaces_emptyArray.

@Test
public void testIndentWithSpaces_emptyArray() throws IOException {
    new JsonArray().writeTo(output, indentWithSpaces(2));
    assertEquals("[\n  \n]", output.toString());
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 59 with JsonArray

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

the class PrettyPrint_Test method testIndentWithSpaces_array.

@Test
public void testIndentWithSpaces_array() throws IOException {
    new JsonArray().add(23).add(42).writeTo(output, indentWithSpaces(2));
    assertEquals("[\n  23,\n  42\n]", output.toString());
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 60 with JsonArray

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

the class PrettyPrint_Test method testIndentWithSpaces_zero.

@Test
public void testIndentWithSpaces_zero() throws IOException {
    new JsonArray().add(23).add(42).writeTo(output, indentWithSpaces(0));
    assertEquals("[\n23,\n42\n]", output.toString());
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

JsonArray (com.hazelcast.internal.json.JsonArray)74 JsonObject (com.hazelcast.internal.json.JsonObject)42 Test (org.junit.Test)39 QuickTest (com.hazelcast.test.annotation.QuickTest)31 JsonValue (com.hazelcast.internal.json.JsonValue)28 HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)10 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)10 CPMember (com.hazelcast.cp.CPMember)7 JsonUtil.getString (com.hazelcast.internal.util.JsonUtil.getString)7 SlowTest (com.hazelcast.test.annotation.SlowTest)7 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 ConnectionResponse (com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)4 Address (com.hazelcast.cluster.Address)3 JetException (com.hazelcast.jet.JetException)3 InputStreamReader (java.io.InputStreamReader)3 Collection (java.util.Collection)3 Map (java.util.Map)3 Request (org.elasticsearch.client.Request)3