@Test public void filterResults() { List<Object[]> results = new ArrayList<>(); results.add(new Object[]{ "A.B", "image.png" }); DocumentReference documentReference = new DocumentReference("wiki", "A", "B"); when(this.resolver.resolve("A.B")).thenReturn(documentReference); List<AttachmentReference> attachmentReferences = this.queryFilter.filterResults(results); AttachmentReference expectedAttachmentReference = new AttachmentReference("image.png", documentReference); assertEquals(Collections.singletonList(expectedAttachmentReference), attachmentReferences); }
@Override public List filterResults(List results) { if (results.size() > 0 && results.get(0).getClass().isArray()) { List<AttachmentReference> attachmentReferences = new ArrayList<>(); for (Object result : results) { Object[] actualResult = (Object[]) result; String documentFullName = String.valueOf(actualResult[0]); String attachmentFileName = String.valueOf(actualResult[1]); DocumentReference documentReference = this.documentReferenceResolver.resolve(documentFullName); attachmentReferences.add(new AttachmentReference(attachmentFileName, documentReference)); } return attachmentReferences; } return results; }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public List filterResults(List results) { if (results.size() > 0 && results.get(0).getClass().isArray()) { List<AttachmentReference> attachmentReferences = new ArrayList<>(); for (Object result : results) { Object[] actualResult = (Object[]) result; String documentFullName = String.valueOf(actualResult[0]); String attachmentFileName = String.valueOf(actualResult[1]); DocumentReference documentReference = this.documentReferenceResolver.resolve(documentFullName); attachmentReferences.add(new AttachmentReference(attachmentFileName, documentReference)); } return attachmentReferences; } return results; } }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public List filterResults(List results) { if (results.size() > 0 && results.get(0).getClass().isArray()) { List<AttachmentReference> attachmentReferences = new ArrayList<>(); for (Object result : results) { Object[] actualResult = (Object[]) result; String documentFullName = String.valueOf(actualResult[0]); String attachmentFileName = String.valueOf(actualResult[1]); DocumentReference documentReference = this.documentReferenceResolver.resolve(documentFullName); attachmentReferences.add(new AttachmentReference(attachmentFileName, documentReference)); } return attachmentReferences; } return results; }  }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public List filterResults(List results) { if (results.size() > 0 && results.get(0).getClass().isArray()) { List<AttachmentReference> attachmentReferences = new ArrayList<>(); for (Object result : results) { Object[] actualResult = (Object[]) result; String documentFullName = String.valueOf(actualResult[0]); String attachmentFileName = String.valueOf(actualResult[1]); DocumentReference documentReference = this.documentReferenceResolver.resolve(documentFullName); attachmentReferences.add(new AttachmentReference(attachmentFileName, documentReference)); } return attachmentReferences; } return results; }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results); }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public List filterResults(List results) { if (results.size() > 0 && results.get(0).getClass().isArray()) { List<AttachmentReference> attachmentReferences = new ArrayList<>(); for (Object result : results) { Object[] actualResult = (Object[]) result; String documentFullName = String.valueOf(actualResult[0]); String attachmentFileName = String.valueOf(actualResult[1]); DocumentReference documentReference = this.documentReferenceResolver.resolve(documentFullName); attachmentReferences.add(new AttachmentReference(attachmentFileName, documentReference)); } return attachmentReferences; } return results; }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results);  }