### Question:
OutputFormatXmlAdapter extends XmlAdapter<ClientReportJobOutputFormatsWrapper, Set<OutputFormat>> { @Override public Set<OutputFormat> unmarshal(ClientReportJobOutputFormatsWrapper v) throws Exception { Set<OutputFormat> result = null; if (v != null && v.getFormats() != null && !v.getFormats().isEmpty()) { result = new HashSet<OutputFormat>(); for (String currentValue : v.getFormats()) { OutputFormat outputFormat = OutputFormat.valueOf(currentValue); result.add(outputFormat); } } return result; }  @Override Set<OutputFormat> unmarshal(ClientReportJobOutputFormatsWrapper v); @Override ClientReportJobOutputFormatsWrapper marshal(Set<OutputFormat> v);  }### Answer:
@Test public void unmarshal_nullValue_nullValue() throws Exception { Set<OutputFormat> actual = objectUnderTest.unmarshal(null); assertNull(actual); }
@Test public void unmarshal_wrapperWithNullFormats_nullValue() throws Exception { ClientReportJobOutputFormatsWrapper wrapper = createClientReportJobOutputFormatsWrapperWithNullFormats(); Set<OutputFormat> actual = objectUnderTest.unmarshal(wrapper); assertNull(actual); }
@Test public void unmarshal_wrapperWithoutFormats_nullValue() throws Exception { ClientReportJobOutputFormatsWrapper wrapper = createClientReportJobOutputFormatsWrapperWithoutFormats(); Set<OutputFormat> actual = objectUnderTest.unmarshal(wrapper); assertNull(actual); }
@Test public void unmarshal_wrapperWithSomeFormats_someFormats() throws Exception { ClientReportJobOutputFormatsWrapper wrapper = createClientReportJobOutputFormatsWrapperWithFormats(); Set<OutputFormat> actual = objectUnderTest.unmarshal(wrapper); assertEquals(TEST_FORMATS, actual); }
@Test public void unmarshal_wrapperWithIlligalFormats_throwsException_IllegalArgumentException() { final ClientReportJobOutputFormatsWrapper wrapper = createClientReportJobOutputFormatsWrapperWithIllegalFormats(); assertThrows( IllegalArgumentException.class, new Executable() { @Override public void execute() throws Exception { objectUnderTest.unmarshal(wrapper); } } ); }