### Question:
ValueOptionPropertyAdapter implements PropertyAdapter<T> { @Override public void write(T property, ValueWriter writer) throws IOException { if (property.isNull()) { if (nullStyle == NullStyle.VALUE) { writer.writeNull(); } } else { doWrite(property, writer); } } protected  ValueOptionPropertyAdapter(BuilderBase<?, ?> builder); @SuppressWarnings("deprecation") @Override void absent(T property); @Override final void read(ValueReader reader, T property); @Override void write(T property, ValueWriter writer); static final NullStyle DEFAULT_NULL_STYLE; }### Answer:
@Test public void write() throws Exception { IntOptionPropertyAdapter adapter = builder.build(); MockValue writer = new MockValue(); adapter.write(new IntOption(100), writer); assertThat(writer.get(), is(100)); }
@Test public void write_null_value() throws Exception { IntOptionPropertyAdapter adapter = builder .withNullStyle(NullStyle.VALUE) .build(); MockValue writer = new MockValue("ABSENT"); adapter.write(new IntOption(), writer); assertThat(writer.get(), is(nullValue())); }
@Test public void write_null_absent() throws Exception { IntOptionPropertyAdapter adapter = builder .withNullStyle(NullStyle.ABSENT) .build(); MockValue writer = new MockValue("ABSENT"); adapter.write(new IntOption(), writer); assertThat(writer.get(), is("ABSENT")); }