DocumentMetadataInputConverter implements InputDocumentConverter<String, DocumentMetadata>, Serializable { @Override public JavaPairRDD<String, MatchableEntity> convertDocuments(JavaPairRDD<String, DocumentMetadata> inputDocuments) { JavaPairRDD<String, MatchableEntity> documentEntities = inputDocuments .mapToPair(document -> new Tuple2<>(document._1, converter.convertToMatchableEntity(document._1, document._2))); return documentEntities; }  @Override JavaPairRDD<String, MatchableEntity> convertDocuments(JavaPairRDD<String, DocumentMetadata> inputDocuments); void setConverter(DocumentMetadataToMatchableConverter converter);  }
@Test public void convertDocuments() throws Exception { doReturn(documents).when(inputDocuments).mapToPair(any()); JavaPairRDD<String, MatchableEntity> retDocuments = documentMetadataInputConverter.convertDocuments(inputDocuments); assertTrue(retDocuments == documents); verify(inputDocuments).mapToPair(convertDocumentFunction.capture()); assertConvertDocumentFunction(convertDocumentFunction.getValue()); }