RemoteDocumentConverter { public static List<DSSDocument> toDSSDocuments(List<RemoteDocument> remoteDocuments) { if (Utils.isCollectionNotEmpty(remoteDocuments)) { List<DSSDocument> dssDocuments = new ArrayList<>(); for (RemoteDocument remoteDocument : remoteDocuments) { DSSDocument dssDocument = toDSSDocument(remoteDocument); if (dssDocument != null) { dssDocuments.add(dssDocument); } } return dssDocuments; } return null; } private  RemoteDocumentConverter(); static List<DSSDocument> toDSSDocuments(List<RemoteDocument> remoteDocuments); static DSSDocument toDSSDocument(RemoteDocument remoteDocument); static List<RemoteDocument> toRemoteDocuments(List<DSSDocument> originalDocuments); static RemoteDocument toRemoteDocument(DSSDocument originalDocument);  }
@Test public void toDSSDocumentsTest() { List<RemoteDocument> remoteDocuments = new ArrayList<>(); remoteDocuments.add(new RemoteDocument(new byte[] {'1','2','3'}, "remoteDocument")); remoteDocuments.add(new RemoteDocument(new byte[] {'4','5','6'}, "remoteDocument2")); remoteDocuments.add(new RemoteDocument(null, null)); remoteDocuments.add(null); List<DSSDocument> dssDocuments = RemoteDocumentConverter.toDSSDocuments(remoteDocuments); assertEquals(2, dssDocuments.size()); assertEquals("remoteDocument", dssDocuments.get(0).getName()); assertEquals("remoteDocument2", dssDocuments.get(1).getName()); }