sijie commented on a change in pull request #2181: augmenting protoschema with
info for parsing
URL: https://github.com/apache/incubator-pulsar/pull/2181#discussion_r203153997
##########
File path:
pulsar-client-schema/src/test/java/org/apache/pulsar/client/schema/ProtobufSchemaTest.java
##########
@@ -67,4 +78,33 @@ public void testSchema() {
Assert.assertEquals(schema.toString(), EXPECTED_SCHEMA_JSON);
}
+
+ @Test
+ public void testGenericOf() {
+ try {
+
ProtobufSchema<org.apache.pulsar.client.schema.proto.Test.TestMessage>
protobufSchema
+ =
ProtobufSchema.ofGenericClass(org.apache.pulsar.client.schema.proto.Test.TestMessage.class,
+ Collections.emptyMap());
+ } catch (Exception e) {
+ Assert.fail();
+ }
+
+ try {
+
ProtobufSchema<org.apache.pulsar.client.schema.proto.Test.TestMessage>
protobufSchema
+ = ProtobufSchema.ofGenericClass(String.class,
+ Collections.emptyMap());
+ Assert.fail();
Review comment:
nit: put a meaningful message in fail method
e.g.
`fail("Should not construct a ProtobufShema over a non-protobuf-generated
class")`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services