use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcResponseTest method shouldToJsonObjectWhenPassingParametersWithResult.
@Test
public void shouldToJsonObjectWhenPassingParametersWithResult() throws Exception {
JsonObject expected = response;
expected.remove("error");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, result, null);
JsonObject actual = jsonRpcResponse.toJsonObject();
assertEquals(expected, actual);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonForCreatedSingleDtoParams.
@Test
public void shouldToJsonForCreatedSingleDtoParams() throws Exception {
JsonObject expected = jsonParser.parse(dto.toString()).getAsJsonObject();
JsonRpcParams jsonRpcParams = new JsonRpcParams(dto, jsonParser);
JsonElement actual = jsonRpcParams.toJsonElement();
assertEquals(expected, actual);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToStringWhenPassStringParamsWithoutIdAndWithoutParams.
@Test
public void shouldToStringWhenPassStringParamsWithoutIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(true);
JsonObject expected = request;
expected.remove("params");
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("method", params, jsonParser);
JsonElement actual = jsonParser.parse(jsonRpcRequest.toString());
assertEquals(expected, actual);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenParseStringParamsWithoutIdAndWithoutParams.
@Test
public void shouldToJsonObjectWhenParseStringParamsWithoutIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("params");
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(request.toString(), jsonParser, jsonRpcFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertEquals(expected, actual);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenParseStringParamsWithIdAndWithoutParams.
@Test
public void shouldToJsonObjectWhenParseStringParamsWithIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("params");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(request.toString(), jsonParser, jsonRpcFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertEquals(expected, actual);
}
Aggregations