use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.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, 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 JsonRpcParamsTest method shouldToJsonValueForParsedListDtoParams.
@Test
public void shouldToJsonValueForParsedListDtoParams() throws Exception {
JsonArray array = new JsonArray();
JsonObject jsonObject = jsonParser.parse(DTO_JSON).getAsJsonObject();
array.add(jsonObject);
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + DTO_JSON + "]", jsonParser);
JsonElement jsonValue = jsonRpcParams.toJsonElement();
assertEquals(array, jsonValue);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcEntityQualifierTest method shouldQualifyUndefinedWhenMessageContainsResultAndError.
@Test
public void shouldQualifyUndefinedWhenMessageContainsResultAndError() {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("error", "error-value");
jsonObject.addProperty("result", "result-value");
JsonRpcEntityType type = qualifier.qualify(jsonObject.toString());
assertEquals(JsonRpcEntityType.UNDEFINED, type);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcEntityQualifierTest method shouldQualifyResponseWhenMessageContainsResult.
@Test
public void shouldQualifyResponseWhenMessageContainsResult() {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("result", "result-value");
JsonRpcEntityType type = qualifier.qualify(jsonObject.toString());
assertEquals(JsonRpcEntityType.RESPONSE, type);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project che by eclipse.
the class JsonRpcEntityQualifierTest method shouldQualifyResponseWhenMessageContainsError.
@Test
public void shouldQualifyResponseWhenMessageContainsError() {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("error", "error-value");
JsonRpcEntityType type = qualifier.qualify(jsonObject.toString());
assertEquals(JsonRpcEntityType.RESPONSE, type);
}
Aggregations