use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringCreatedListBooleanParams.
@Test
public void shouldToStringCreatedListBooleanParams() throws Exception {
Boolean value = false;
List<Boolean> list = singletonList(value);
JsonArray jsonArray = new JsonArray();
jsonArray.add(new JsonPrimitive(value));
String expected = jsonArray.toString();
JsonRpcParams jsonRpcParams = new JsonRpcParams(list, jsonParser);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsASingleNumber.
@Test
public void shouldToJsonValueWhenParsingStringWithResultAsASingleNumber() throws Exception {
JsonPrimitive expected = new JsonPrimitive(0D);
JsonRpcResult jsonRpcResult = new JsonRpcResult(expected.toString(), jsonParser);
JsonElement actual = jsonRpcResult.toJsonElement();
assertEquals(expected, actual);
}
use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcListTest method shouldToJsonArrayCreatedBooleanArray.
@Test
public void shouldToJsonArrayCreatedBooleanArray() throws Exception {
JsonArray expected = new JsonArray();
expected.add(new JsonPrimitive(false));
JsonRpcList jsonRpcList = new JsonRpcList(singletonList(false), jsonParser);
JsonArray actual = jsonRpcList.toJsonArray();
assertEquals(expected, actual);
}
use of com.google.gson.JsonPrimitive 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.JsonPrimitive 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);
}
Aggregations