@Test public void pickDocument() throws Exception { DocumentMetadata firstDocument = new DocumentMetadata("id-1", null, null, Lists.newArrayList()); DocumentMetadata secondDocument = new DocumentMetadata("id-2", null, null, Lists.newArrayList()); DocumentMetadata thirdDocument = new DocumentMetadata("id-3", null, null, Lists.newArrayList()); Iterable<DocumentMetadata> documents = Lists.newArrayList(firstDocument, secondDocument, thirdDocument); DocumentMetadata retDocument = documentPickFunction.call(documents); assertEquals(firstDocument, retDocument); }
@Override public DocumentMetadata call(Iterable<DocumentMetadata> documents) throws Exception { return documents.iterator().next(); }
PickFirstDocumentFunction implements Function<Iterable<DocumentMetadata>, DocumentMetadata> { @Override public DocumentMetadata call(Iterable<DocumentMetadata> documents) throws Exception { return documents.iterator().next(); } }
PickFirstDocumentFunction implements Function<Iterable<DocumentMetadata>, DocumentMetadata> { @Override public DocumentMetadata call(Iterable<DocumentMetadata> documents) throws Exception { return documents.iterator().next(); }  }
PickFirstDocumentFunction implements Function<Iterable<DocumentMetadata>, DocumentMetadata> { @Override public DocumentMetadata call(Iterable<DocumentMetadata> documents) throws Exception { return documents.iterator().next(); }  @Override DocumentMetadata call(Iterable<DocumentMetadata> documents); }
PickFirstDocumentFunction implements Function<Iterable<DocumentMetadata>, DocumentMetadata> { @Override public DocumentMetadata call(Iterable<DocumentMetadata> documents) throws Exception { return documents.iterator().next(); }  @Override DocumentMetadata call(Iterable<DocumentMetadata> documents);  }