CoansysInputCitationConverter implements InputCitationConverter<String, ReferenceMetadata>, Serializable { @Override public JavaPairRDD<String, MatchableEntity> convertCitations(JavaPairRDD<String, ReferenceMetadata> inputCitations) { return inputCitations.mapPartitionsToPair(docIdReferenceIterator -> { RawReferenceToEntityConverter rawReferenceToEntityConverter = rawReferenceToEntityConverterFactory.createRawReferenceToEntityConverter(model); referenceMetadataConverter.setRawReferenceToEntityConverter(rawReferenceToEntityConverter); return referenceMetadataConverter.convertToMatchableEntities(docIdReferenceIterator); }); }  @Override JavaPairRDD<String, MatchableEntity> convertCitations(JavaPairRDD<String, ReferenceMetadata> inputCitations); void setRawReferenceToEntityConverterFactory(RawReferenceToEntityConverterFactory rawReferenceToEntityConverterFactory); void setReferenceMetadataConverter(ReferenceMetadataConverter referenceMetadataConverter); void setModel(String model);  }
@Test public void convertCitations() throws Exception { doReturn(citations).when(references).mapPartitionsToPair(Mockito.any()); JavaPairRDD<String, MatchableEntity> convertedCitations = coansysInputCitationConverter.convertCitations(references); assertTrue(citations == convertedCitations); verify(references).mapPartitionsToPair(convertToMatchableEntitiesFunction.capture()); assertConvertToMatchableEntitiesFunction(convertToMatchableEntitiesFunction.getValue()); }