SerializableAvroCodecFactory implements Externalizable { @Override public String toString() { checkNotNull(codecFactory, "Inner CodecFactory is null, please use non default constructor"); return codecFactory.toString(); } SerializableAvroCodecFactory();  SerializableAvroCodecFactory(CodecFactory codecFactory); @Override void writeExternal(ObjectOutput out); @Override void readExternal(ObjectInput in); CodecFactory getCodec(); @Override String toString();  }
@Test(expected = NullPointerException.class) public void testNullCodecToString() throws Exception { SerializableAvroCodecFactory codec = new SerializableAvroCodecFactory(); codec.toString(); }