RemoteDocumentConverter { public static List<RemoteDocument> toRemoteDocuments(List<DSSDocument> originalDocuments) { List<RemoteDocument> results = new ArrayList<>(); for (DSSDocument originalDocument : originalDocuments) { RemoteDocument remoteDocument = toRemoteDocument(originalDocument); if (remoteDocument != null) { results.add(remoteDocument); } } return results; } 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 toRemoteDocumentsTest() { List<DSSDocument> dssDocuments = new ArrayList<>(); dssDocuments.add(new InMemoryDocument(new byte[] {'1','2','3'}, "inMemoryDocument", MimeType.BINARY)); dssDocuments.add(new InMemoryDocument(new byte[] {'1','2','3'}, "inMemoryDocument2")); dssDocuments.add(new DigestDocument(DigestAlgorithm.SHA256, "332b7ce3b5e8f8c6132f0e09264db9da6d1c9fd6e37b73a35e68f78f4e590f90", "digestDocument")); dssDocuments.add(null); List<RemoteDocument> remoteDocuments = RemoteDocumentConverter.toRemoteDocuments(dssDocuments); assertEquals(3, remoteDocuments.size()); assertEquals("inMemoryDocument", remoteDocuments.get(0).getName()); assertEquals("inMemoryDocument2", remoteDocuments.get(1).getName()); assertEquals("digestDocument", remoteDocuments.get(2).getName()); }