Search in sources :

Example 6 with Type

use of com.google.protobuf.Type in project grpc-java by grpc.

the class ProtoUtilsTest method testJsonInvalid.

@Ignore("https://github.com/google/protobuf/issues/1470")
@Test
public void testJsonInvalid() throws Exception {
    Marshaller<Type> marshaller = ProtoUtils.jsonMarshaller(Type.getDefaultInstance());
    try {
        marshaller.parse(new ByteArrayInputStream("{]".getBytes("UTF-8")));
        fail("Expected exception");
    } catch (StatusRuntimeException ex) {
        assertEquals(Status.Code.INTERNAL, ex.getStatus().getCode());
        assertNotNull(ex.getCause());
    }
}
Also used : Type(com.google.protobuf.Type) ByteArrayInputStream(java.io.ByteArrayInputStream) StatusRuntimeException(io.grpc.StatusRuntimeException) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Type (com.google.protobuf.Type)6 ByteArrayInputStream (java.io.ByteArrayInputStream)6 Test (org.junit.Test)6 StatusRuntimeException (io.grpc.StatusRuntimeException)3 InputStream (java.io.InputStream)3 IOException (java.io.IOException)1 Ignore (org.junit.Ignore)1