use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToStringWhenParseStringParamsWithoutIdAndWithParams.
@Test
public void shouldToStringWhenParseStringParamsWithoutIdAndWithParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(request.toJson(), jsonFactory, jsonRpcFactory);
JsonValue actual = jsonFactory.parse(jsonRpcRequest.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringForParsedListDtoParams.
@Test
public void shouldToStringForParsedListDtoParams() throws Exception {
JsonArray array = jsonFactory.createArray();
JsonObject jsonObject = jsonFactory.parse(DTO_JSON);
array.set(0, jsonObject);
String expected = array.toJson();
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + DTO_JSON + "]", jsonFactory, dtoFactory);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenParseStringParamsWithoutIdAndWithParams.
@Test
public void shouldToJsonObjectWhenParseStringParamsWithoutIdAndWithParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(request.toJson(), jsonFactory, jsonRpcFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenPassStringParamsWithoutIdAndWithoutParams.
@Test
public void shouldToJsonObjectWhenPassStringParamsWithoutIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(true);
JsonObject expected = request;
expected.remove("params");
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("method", params, jsonFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenPassStringParamsWithIdAndWithParams.
@Test
public void shouldToJsonObjectWhenPassStringParamsWithIdAndWithParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("0", "method", params, jsonFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertTrue(expected.jsEquals(actual));
}
Aggregations