use of elemental.json.JsonArray 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 = jsonFactory.createArray();
jsonArray.set(0, value);
String expected = jsonArray.toJson();
JsonRpcParams jsonRpcParams = new JsonRpcParams(list, jsonFactory, dtoFactory);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcResultTest method shouldToJsonValueWhenPassingParametersWithResultAsAListOfDto.
@Test
public void shouldToJsonValueWhenPassingParametersWithResultAsAListOfDto() throws Exception {
JsonArray expected = jsonFactory.createArray();
JsonObject value = jsonFactory.parse(dto.toString());
expected.set(0, value);
JsonRpcResult jsonRpcResult = new JsonRpcResult(singletonList(dto), jsonFactory, dtoFactory);
JsonValue actual = jsonRpcResult.toJsonValue();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsAListOfString.
@Test
public void shouldToJsonValueWhenParsingStringWithResultAsAListOfString() throws Exception {
JsonString string = jsonFactory.create("a");
JsonArray expected = jsonFactory.createArray();
expected.set(0, string);
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 shouldToStringWhenPassingParametersWithResultAsAListOfDto.
@Test
public void shouldToStringWhenPassingParametersWithResultAsAListOfDto() throws Exception {
JsonArray array = jsonFactory.createArray();
JsonObject value = jsonFactory.parse(dto.toString());
array.set(0, value);
String expected = array.toJson();
JsonRpcResult jsonRpcResult = new JsonRpcResult(singletonList(dto), jsonFactory, dtoFactory);
String actual = jsonRpcResult.toString();
assertEquals(expected, actual);
}
use of elemental.json.JsonArray in project che by eclipse.
the class JsonRpcResultTest method shouldToStringWhenPassingParametersWithResultAsAListOfString.
@Test
public void shouldToStringWhenPassingParametersWithResultAsAListOfString() throws Exception {
String value = "a";
JsonArray array = jsonFactory.createArray();
array.set(0, value);
String expected = array.toJson();
JsonRpcResult jsonRpcResult = new JsonRpcResult(singletonList(value), jsonFactory, dtoFactory);
String actual = jsonRpcResult.toString();
assertEquals(expected, actual);
}
Aggregations