AdapterComponentDocRepositoryHelper { HashMap<String, DataHandler> getDocumentMap(ProvideAndRegisterDocumentSetRequestType body) { List<ProvideAndRegisterDocumentSetRequestType.Document> binaryDocs = body.getDocument(); LOG.debug("There are {} binary documents in this request.", binaryDocs.size()); HashMap<String, DataHandler> docMap = new HashMap<>(); for (ProvideAndRegisterDocumentSetRequestType.Document tempDoc : binaryDocs) { docMap.put(tempDoc.getId(), tempDoc.getValue()); } return docMap; }    }
@Test public void testGetDocumentMap() throws IOException { AdapterComponentDocRepositoryHelper docRepoHelper = new AdapterComponentDocRepositoryHelper(); ProvideAndRegisterDocumentSetRequestType body = mock(ProvideAndRegisterDocumentSetRequestType.class); List<ProvideAndRegisterDocumentSetRequestType.Document> docList = new ArrayList<>(); ProvideAndRegisterDocumentSetRequestType.Document doc = new ProvideAndRegisterDocumentSetRequestType.Document(); final String ID = "MOCK_ID"; final String VALUE = "MOCK_VALUE"; DataHandler dataHandler = LargeFileUtils.getInstance().convertToDataHandler(VALUE); doc.setId(ID); doc.setValue(dataHandler); docList.add(doc); when(body.getDocument()).thenReturn(docList); HashMap<String, DataHandler> docMap = docRepoHelper.getDocumentMap(body); assertEquals(docMap.get(ID), dataHandler); }