@Test public void test_getDocumentByUploadId_severalDocExists() throws Exception { IDocument doc1 = new Document(); doc1.setId(DOC1_ID); doc1.setUploadId(UPLOAD1_ID); IDocument doc2 = new Document(); doc2.setId(DOC2_ID); doc2.setUploadId(UPLOAD1_ID); List<IDocument> result = new ArrayList<IDocument>(); result.add(doc1); result.add(doc2); IDocumentDatabaseClient partiallyMockedClient = new DocumentDatabaseClient() { @Override protected List<IDocument> searchByProperty(String propName, String propValue, Class<? extends IDocument> clazz) { return result; } }; List<IDocument> searchResult = partiallyMockedClient.getDocumentByUploadId(UPLOAD1_ID); Assert.assertEquals(2, searchResult.size()); Assert.assertTrue(searchResult.stream().allMatch(r -> r.getUploadId().equals(UPLOAD1_ID))); }
@Override public List<IDocument> getDocumentByUploadId(String uploadId) { return getDocumentList("uploadId", uploadId); }
DocumentDatabaseClient extends DatabaseClient<IDocument> implements
        IDocumentDatabaseClient { @Override public List<IDocument> getDocumentByUploadId(String uploadId) { return getDocumentList("uploadId", uploadId); } }
DocumentDatabaseClient extends DatabaseClient<IDocument> implements
        IDocumentDatabaseClient { @Override public List<IDocument> getDocumentByUploadId(String uploadId) { return getDocumentList("uploadId", uploadId); }  }
DocumentDatabaseClient extends DatabaseClient<IDocument> implements
        IDocumentDatabaseClient { @Override public List<IDocument> getDocumentByUploadId(String uploadId) { return getDocumentList("uploadId", uploadId); }  @Override IDocument saveDocument(IDocument document); @Override IDocument getDocumentById(String id); @Override List<IDocument> getDocumentByUploadId(String uploadId); @Override List<IDocument> getDocumentsByUsername(String username); }
DocumentDatabaseClient extends DatabaseClient<IDocument> implements
        IDocumentDatabaseClient { @Override public List<IDocument> getDocumentByUploadId(String uploadId) { return getDocumentList("uploadId", uploadId); }  @Override IDocument saveDocument(IDocument document); @Override IDocument getDocumentById(String id); @Override List<IDocument> getDocumentByUploadId(String uploadId); @Override List<IDocument> getDocumentsByUsername(String username);  }