use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringForParsedListBooleanParams.
@Test
public void shouldToStringForParsedListBooleanParams() throws Exception {
Boolean value = false;
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.JsonPrimitive in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonForCreatedListStringParams.
@Test
public void shouldToJsonForCreatedListStringParams() throws Exception {
String value = "value";
JsonArray expected = new JsonArray();
expected.add(new JsonPrimitive(value));
JsonRpcParams jsonRpcParams = new JsonRpcParams(singletonList(value), jsonParser);
JsonElement actual = jsonRpcParams.toJsonElement();
assertEquals(expected, actual);
}
use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonValueForParsedListBooleanParams.
@Test
public void shouldToJsonValueForParsedListBooleanParams() throws Exception {
Boolean expected = false;
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(expected));
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + expected + "]", jsonParser);
JsonElement jsonValue = jsonRpcParams.toJsonElement();
assertEquals(array, jsonValue);
}
use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonForCreatedListBooleanParams.
@Test
public void shouldToJsonForCreatedListBooleanParams() throws Exception {
Boolean value = false;
List<Boolean> list = singletonList(value);
JsonArray expected = new JsonArray();
expected.add(new JsonPrimitive(value));
JsonRpcParams jsonRpcParams = new JsonRpcParams(list, jsonParser);
JsonElement actual = jsonRpcParams.toJsonElement();
assertEquals(expected, actual);
}
use of com.google.gson.JsonPrimitive in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringCreatedListDoubleParams.
@Test
public void shouldToStringCreatedListDoubleParams() throws Exception {
double value = 0D;
List<Double> 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);
}
Aggregations