use of elemental.json.JsonValue 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.JsonValue in project che by eclipse.
the class JsonRpcResponseTest method shouldToStringWhenPassingParametersWithError.
@Test
public void shouldToStringWhenPassingParametersWithError() throws Exception {
JsonObject expected = response;
expected.remove("result");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, null, error, jsonFactory);
JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonValue in project che by eclipse.
the class JsonRpcResponseTest method shouldToStringWhenParsingStringWithError.
@Test
public void shouldToStringWhenParsingStringWithError() throws Exception {
JsonObject expected = response;
expected.remove("result");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(expected.toJson(), jsonFactory, dtoFactory);
JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonValue in project che by eclipse.
the class JsonRpcResponseTest method shouldToStringWhenPassingParametersWithResult.
@Test
public void shouldToStringWhenPassingParametersWithResult() throws Exception {
JsonObject expected = response;
expected.remove("error");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, result, null, jsonFactory);
JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonValue in project che by eclipse.
the class JsonRpcResponseTest method shouldToStringWhenParsingStringWithResult.
@Test
public void shouldToStringWhenParsingStringWithResult() throws Exception {
JsonObject expected = response;
expected.remove("error");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(expected.toJson(), jsonFactory, dtoFactory);
JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
assertTrue(expected.jsEquals(actual));
}
Aggregations