SerializationFactory extends Configured { public <T> Serializer<T> getSerializer(Class<T> c) { Serialization<T> serializer = getSerialization(c); if (serializer != null) { return serializer.getSerializer(c); } return null; } SerializationFactory(Configuration conf); Serializer<T> getSerializer(Class<T> c); Deserializer<T> getDeserializer(Class<T> c); @SuppressWarnings("unchecked") Serialization<T> getSerialization(Class<T> c);  }
@Test public void testSerializationKeyIsTrimmed() { Configuration conf = new Configuration(); conf.set(CommonConfigurationKeys.IO_SERIALIZATIONS_KEY, " org.apache.hadoop.io.serializer.WritableSerialization "); SerializationFactory factory = new SerializationFactory(conf); assertNotNull("Valid class must be returned", factory.getSerializer(LongWritable.class)); }
@Test public void testGetSerializer() { assertNotNull("A valid class must be returned for default Writable SerDe", factory.getSerializer(Writable.class)); assertNull("A null should be returned if there are no serializers found.", factory.getSerializer(TestSerializationFactory.class)); }