use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToStringArrayParsedBooleanArray.
@Test
public void shouldToStringArrayParsedBooleanArray() throws Exception {
Boolean expected = false;
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 shouldToStringCreatedStringArray.
@Test
public void shouldToStringCreatedStringArray() throws Exception {
JsonArray array = new JsonArray();
array.add(new JsonPrimitive("a"));
String expected = array.toString();
JsonRpcList jsonRpcList = new JsonRpcList(singletonList("a"), jsonParser);
String actual = jsonRpcList.toString();
assertEquals(expected, actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcListTest method shouldToListParsedNumberArray.
@Test
public void shouldToListParsedNumberArray() throws Exception {
Double expected = 0D;
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(expected));
String message = array.toString();
JsonRpcList jsonRpcList = new JsonRpcList(message, jsonParser);
List<Double> actual = jsonRpcList.toList(Double.class);
assertEquals(singletonList(expected), actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringForParsedListDoubleParams.
@Test
public void shouldToStringForParsedListDoubleParams() throws Exception {
Double value = 0D;
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(value));
String expected = array.toString();
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + value + "]", jsonParser);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of com.google.gson.JsonArray in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonValueForParsedListDtoParams.
@Test
public void shouldToJsonValueForParsedListDtoParams() throws Exception {
JsonArray array = new JsonArray();
JsonObject jsonObject = jsonParser.parse(DTO_JSON).getAsJsonObject();
array.add(jsonObject);
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + DTO_JSON + "]", jsonParser);
JsonElement jsonValue = jsonRpcParams.toJsonElement();
assertEquals(array, jsonValue);
}
Aggregations