use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcResultTest method shouldGetAsVoidWhenParsingStringWithResultAsVoid.
//Void
@Test
public void shouldGetAsVoidWhenParsingStringWithResultAsVoid() throws Exception {
JsonObject value = jsonFactory.createObject();
Void expected = null;
JsonRpcResult jsonRpcResult = new JsonRpcResult(value.toJson(), jsonFactory, dtoFactory);
Void actual = jsonRpcResult.getAs(Void.class);
assertEquals(expected, actual);
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsASingleDto.
@Test
public void shouldToJsonValueWhenParsingStringWithResultAsASingleDto() throws Exception {
JsonObject value = jsonFactory.parse(dto.toString());
JsonRpcResult jsonRpcResult = new JsonRpcResult(dto.toString(), jsonFactory, dtoFactory);
JsonValue actual = jsonRpcResult.toJsonValue();
assertTrue(value.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToStringWhenPassStringParamsWithIdAndWithParams.
@Test
public void shouldToStringWhenPassStringParamsWithIdAndWithParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("0", "method", params, jsonFactory);
JsonValue actual = jsonFactory.parse(jsonRpcRequest.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToStringWhenPassStringParamsWithoutIdAndWithParams.
@Test
public void shouldToStringWhenPassStringParamsWithoutIdAndWithParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("method", params, jsonFactory);
JsonValue actual = jsonFactory.parse(jsonRpcRequest.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenPassStringParamsWithIdAndWithoutParams.
@Test
public void shouldToJsonObjectWhenPassStringParamsWithIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(true);
JsonObject expected = request;
expected.remove("params");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("0", "method", params, jsonFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertTrue(expected.jsEquals(actual));
}
Aggregations