### Question:
FilesMapXmlAdapter extends XmlAdapter<ClientReportUnitResourceListWrapper, Map<String, ClientReferenceableFile>> { @Override public ClientReportUnitResourceListWrapper marshal(Map<String, ClientReferenceableFile> files) throws Exception { List<ClientReportUnitResource> result = null; if (files != null) { result = new ArrayList<ClientReportUnitResource>(); for (String name : files.keySet()) { result.add(new ClientReportUnitResource(name, files.get(name))); } } return result== null ? null : new ClientReportUnitResourceListWrapper(result); }  @Override ClientReportUnitResourceListWrapper marshal(Map<String, ClientReferenceableFile> files); @Override Map<String, ClientReferenceableFile> unmarshal(ClientReportUnitResourceListWrapper v);  }### Answer:
@Test public void marshal_nullProducesNull() throws Exception { assertNull(adapter.marshal(null)); }
@Test public void marshal_emtpyProducesEmpty() throws Exception { final ClientReportUnitResourceListWrapper wrapper = adapter.marshal(new HashMap<String, ClientReferenceableFile>()); assertNotNull(wrapper); assertNotNull(wrapper.getFiles()); assertTrue(wrapper.getFiles().isEmpty()); }
@Test public void marshal() throws Exception{ final HashMap<String, ClientReferenceableFile> files = new HashMap<String, ClientReferenceableFile>(); files.put("file1", new ClientReference("/some/uri1")); files.put("file2", new ClientFile()); files.put("file3", new ClientReference("/some/uri2")); files.put("file4", new ClientFile()); final ClientReportUnitResourceListWrapper wrapper = adapter.marshal(files); assertNotNull(wrapper); final List<ClientReportUnitResource> filesList = wrapper.getFiles(); assertNotNull(filesList); assertEquals(filesList.size(), files.size()); for(ClientReportUnitResource currentResource : filesList){ assertSame(files.get(currentResource.getName()), currentResource.getFile()); } }