### Question:
NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); }  T fromString(String representation); String toString(T value);  }### Answer:
@Test public void nullToString() throws Exception { Converter<Boolean> converter = new NullHandlingConverter<Boolean>() { @Override protected Boolean fromNonNullableString(String representation) { throw new UnsupportedOperationException(); } @Override protected String nonNullableToString(Boolean value) { throw new UnsupportedOperationException(); } }; assertNull(converter.toString(null)); }
@Test public void notNullToString() throws Exception { Converter<Boolean> converter = new NullHandlingConverter<Boolean>() { @Override protected Boolean fromNonNullableString(String representation) { throw new UnsupportedOperationException(); } @Override protected String nonNullableToString(Boolean value) { return ""; } }; assertEquals("", converter.toString(true)); }