use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject 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);
JsonElement actual = jsonParser.parse(jsonRpcResponse.toString());
assertEquals(expected, actual);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcResponseTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
response = new JsonObject();
JsonObject error = new JsonObject();
JsonObject result = new JsonObject();
error.addProperty("code", 0);
error.addProperty("message", "error message");
response.addProperty("jsonrpc", "2.0");
response.addProperty("id", "0");
response.add("error", error);
response.add("result", result);
when(this.result.toJsonElement()).thenReturn(result);
when(this.error.toJsonObject()).thenReturn(error);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject 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.toString(), jsonParser);
JsonElement actual = jsonParser.parse(jsonRpcResponse.toString());
assertEquals(expected, actual);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcResponseTest method shouldToJsonObjectWhenParsingStringWithError.
@Test
public void shouldToJsonObjectWhenParsingStringWithError() throws Exception {
JsonObject expected = response;
expected.remove("result");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(expected.toString(), jsonParser);
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 JsonRpcResponseTest method shouldToJsonObjectWhenPassingParametersWithError.
@Test
public void shouldToJsonObjectWhenPassingParametersWithError() throws Exception {
JsonObject expected = response;
expected.remove("result");
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, null, error);
JsonObject actual = jsonRpcResponse.toJsonObject();
assertEquals(expected, actual);
}
Aggregations