ProtoCoder extends CustomCoder<T> { public static CoderProvider getCoderProvider() { return new ProtoCoderProvider(); } protected  ProtoCoder(Class<T> protoMessageClass, Set<Class<?>> extensionHostClasses); static ProtoCoder<T> of(Class<T> protoMessageClass); static ProtoCoder<T> of(TypeDescriptor<T> protoMessageType); ProtoCoder<T> withExtensionsFrom(Iterable<Class<?>> moreExtensionHosts); ProtoCoder<T> withExtensionsFrom(Class<?>... moreExtensionHosts); @Override void encode(T value, OutputStream outStream); @Override void encode(T value, OutputStream outStream, Context context); @Override T decode(InputStream inStream); @Override T decode(InputStream inStream, Context context); @Override boolean equals(@Nullable Object other); @Override int hashCode(); @Override void verifyDeterministic(); Class<T> getMessageType(); Set<Class<?>> getExtensionHosts(); ExtensionRegistry getExtensionRegistry(); static CoderProvider getCoderProvider(); static final long serialVersionUID; }
@Test public void testProviderCannotProvideCoder() throws Exception { thrown.expect(CannotProvideCoderException.class); thrown.expectMessage("java.lang.Integer is not a subclass of com.google.protobuf.Message"); ProtoCoder.getCoderProvider() .coderFor(new TypeDescriptor<Integer>() {}, Collections.emptyList()); }