use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringForParsedListBooleanParams.
@Test
public void shouldToStringForParsedListBooleanParams() throws Exception {
Boolean value = false;
JsonArray array = jsonFactory.createArray();
array.set(0, value);
String expected = array.toJson();
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + value + "]", jsonFactory, dtoFactory);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonForCreatedListDoubleParams.
@Test
public void shouldToJsonForCreatedListDoubleParams() throws Exception {
double value = 0D;
List<Double> list = singletonList(value);
JsonArray expected = jsonFactory.createArray();
expected.set(0, value);
JsonRpcParams jsonRpcParams = new JsonRpcParams(list, jsonFactory, dtoFactory);
JsonValue actual = jsonRpcParams.toJsonValue();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcResultTest method shouldToStringWhenParsingStringWithResultAsAListOfDto.
@Test
public void shouldToStringWhenParsingStringWithResultAsAListOfDto() throws Exception {
JsonArray array = jsonFactory.createArray();
JsonObject value = jsonFactory.parse(dto.toString());
array.set(0, value);
String expected = array.toJson();
JsonRpcResult jsonRpcResult = new JsonRpcResult(array.toJson(), jsonFactory, dtoFactory);
String actual = jsonRpcResult.toString();
assertEquals(expected, actual);
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsAListOfDto.
@Test
public void shouldToJsonValueWhenParsingStringWithResultAsAListOfDto() throws Exception {
JsonArray expected = jsonFactory.createArray();
JsonObject value = jsonFactory.parse(dto.toString());
expected.set(0, value);
JsonRpcResult jsonRpcResult = new JsonRpcResult(expected.toJson(), jsonFactory, dtoFactory);
JsonValue actual = jsonRpcResult.toJsonValue();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcResultTest method shouldToStringWhenPassingParametersWithResultAsAListOfNumber.
@Test
public void shouldToStringWhenPassingParametersWithResultAsAListOfNumber() throws Exception {
Double value = 0D;
JsonNumber string = jsonFactory.create(value);
JsonArray array = jsonFactory.createArray();
array.set(0, string);
String expected = array.toJson();
JsonRpcResult jsonRpcResult = new JsonRpcResult(singletonList(value), jsonFactory, dtoFactory);
String actual = jsonRpcResult.toString();
assertEquals(expected, actual);
}
Aggregations