DirectCitationToCitationConverter implements Serializable { public Citation convert(eu.dnetlib.iis.citationmatching.direct.schemas.Citation directCitation) { Preconditions.checkNotNull(directCitation); CitationEntry citationEntry = CitationEntry.newBuilder() .setPosition(directCitation.getPosition()) .setRawText(null) .setDestinationDocumentId(directCitation.getDestinationDocumentId()) .setConfidenceLevel(1f) .setExternalDestinationDocumentIds(Maps.newHashMap()) .build(); Citation citation = Citation.newBuilder() .setSourceDocumentId(directCitation.getSourceDocumentId()) .setEntry(citationEntry) .build(); return citation; }  Citation convert(eu.dnetlib.iis.citationmatching.direct.schemas.Citation directCitation);  }
@Test(expected = NullPointerException.class) public void convert_NULL() { converter.convert(null); }
@Test public void convert() { eu.dnetlib.iis.citationmatching.direct.schemas.Citation directCitation = eu.dnetlib.iis.citationmatching.direct.schemas.Citation.newBuilder() .setSourceDocumentId("source-doc-id") .setPosition(4) .setDestinationDocumentId("dest-doc-id") .build(); Citation retCitation = converter.convert(directCitation); Citation expectedCitation = Citation.newBuilder() .setSourceDocumentId("source-doc-id") .setEntry(CitationEntry.newBuilder() .setConfidenceLevel(1f) .setDestinationDocumentId("dest-doc-id") .setExternalDestinationDocumentIds(Maps.newHashMap()) .setPosition(4) .setRawText(null) .build()) .build(); assertEquals(expectedCitation, retCitation); }