use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToListParsedBooleanArray.
@Test
public void shouldToListParsedBooleanArray() throws Exception {
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(false));
String message = array.toString();
JsonRpcList jsonRpcList = new JsonRpcList(message, jsonParser);
List<Boolean> actual = jsonRpcList.toList(Boolean.class);
assertEquals(singletonList(false), actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToJsonArrayCreatedDoubleArray.
@Test
public void shouldToJsonArrayCreatedDoubleArray() throws Exception {
JsonArray expected = new JsonArray();
expected.add(new JsonPrimitive(0D));
JsonRpcList jsonRpcList = new JsonRpcList(singletonList(0D), jsonParser);
JsonArray actual = jsonRpcList.toJsonArray();
assertEquals(expected, actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToStringArrayParsedNumberArray.
@Test
public void shouldToStringArrayParsedNumberArray() throws Exception {
Double expected = 0D;
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(expected));
String message = array.toString();
JsonRpcList jsonRpcList = new JsonRpcList(message, jsonParser);
String actual = jsonRpcList.toString();
assertEquals(message, actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToStringCreatedBooleanArray.
@Test
public void shouldToStringCreatedBooleanArray() throws Exception {
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(false));
String expected = array.toString();
JsonRpcList jsonRpcList = new JsonRpcList(singletonList(false), jsonParser);
String actual = jsonRpcList.toString();
assertEquals(expected, actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToStringifiedListParsedBooleanArray.
@Test
public void shouldToStringifiedListParsedBooleanArray() throws Exception {
Boolean expected = false;
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(expected));
String message = array.toString();
JsonRpcList jsonRpcList = new JsonRpcList(message, jsonParser);
List<String> actual = jsonRpcList.toStringifiedList();
assertEquals(expected, Boolean.valueOf(actual.iterator().next()));
}
Aggregations