### Question:
ProtobufSerializationProvider implements SerializationProvider { @Override public <T> StreamingSerializer getSerializer(final Class<T> classToSerialize) { requireMessageLite(classToSerialize); return new ProtobufSerializer(); } ProtobufSerializationProvider();  ProtobufSerializationProvider(final Function<Class<?>, Parser<?>> parserForClass); @Override StreamingSerializer getSerializer(final Class<T> classToSerialize); @Override StreamingSerializer getSerializer(final TypeHolder<T> typeToSerialize); @Override @SuppressWarnings("unchecked") StreamingDeserializer<T> getDeserializer(final Class<T> classToDeSerialize); @Override StreamingDeserializer<T> getDeserializer(final TypeHolder<T> typeToDeserialize);  }### Answer:
@Test public void serializeMessageByClass() { Buffer buffer = newBuffer(); provider.getSerializer(DummyMessage.class).serialize(testMessage, buffer); assertThat(toBytes(buffer), equalTo(testMessageBytes)); }
@Test public void serializeMessageByType() { Buffer buffer = newBuffer(); provider.getSerializer(typeHolder).serialize(testMessage, buffer); assertThat(toBytes(buffer), equalTo(testMessageBytes)); }
@Test public void invalidSerializerClassException() { expectedException.expect(SerializationException.class); provider.getSerializer(String.class); }