@Test public void convert_null_affiliations() { ExtractedDocumentMetadata document = new ExtractedDocumentMetadata(); document.setId("xxx"); assertNull(document.getAffiliations()); List<AffMatchAffiliation> affMatchAffiliations = converter.convert(document); assertNotNull(affMatchAffiliations); assertTrue(affMatchAffiliations.size() == 0); }
public List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document) { Preconditions.checkNotNull(document); Preconditions.checkArgument(StringUtils.isNotBlank(document.getId())); List<AffMatchAffiliation> affMatchAffiliations = new ArrayList<>(); if (CollectionUtils.isEmpty(document.getAffiliations())) { return affMatchAffiliations; } for (int i = 0; i < document.getAffiliations().size(); i++) { Affiliation srcAffiliation = document.getAffiliations().get(i); if (isAuthorAffiliation(i, document.getAuthors())) { affMatchAffiliations.add(convertAffiliation(document.getId(), i + 1, srcAffiliation)); } } return affMatchAffiliations; }
AffiliationConverter implements Serializable { public List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document) { Preconditions.checkNotNull(document); Preconditions.checkArgument(StringUtils.isNotBlank(document.getId())); List<AffMatchAffiliation> affMatchAffiliations = new ArrayList<>(); if (CollectionUtils.isEmpty(document.getAffiliations())) { return affMatchAffiliations; } for (int i = 0; i < document.getAffiliations().size(); i++) { Affiliation srcAffiliation = document.getAffiliations().get(i); if (isAuthorAffiliation(i, document.getAuthors())) { affMatchAffiliations.add(convertAffiliation(document.getId(), i + 1, srcAffiliation)); } } return affMatchAffiliations; } }
AffiliationConverter implements Serializable { public List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document) { Preconditions.checkNotNull(document); Preconditions.checkArgument(StringUtils.isNotBlank(document.getId())); List<AffMatchAffiliation> affMatchAffiliations = new ArrayList<>(); if (CollectionUtils.isEmpty(document.getAffiliations())) { return affMatchAffiliations; } for (int i = 0; i < document.getAffiliations().size(); i++) { Affiliation srcAffiliation = document.getAffiliations().get(i); if (isAuthorAffiliation(i, document.getAuthors())) { affMatchAffiliations.add(convertAffiliation(document.getId(), i + 1, srcAffiliation)); } } return affMatchAffiliations; }  }
AffiliationConverter implements Serializable { public List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document) { Preconditions.checkNotNull(document); Preconditions.checkArgument(StringUtils.isNotBlank(document.getId())); List<AffMatchAffiliation> affMatchAffiliations = new ArrayList<>(); if (CollectionUtils.isEmpty(document.getAffiliations())) { return affMatchAffiliations; } for (int i = 0; i < document.getAffiliations().size(); i++) { Affiliation srcAffiliation = document.getAffiliations().get(i); if (isAuthorAffiliation(i, document.getAuthors())) { affMatchAffiliations.add(convertAffiliation(document.getId(), i + 1, srcAffiliation)); } } return affMatchAffiliations; }  List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document); }
AffiliationConverter implements Serializable { public List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document) { Preconditions.checkNotNull(document); Preconditions.checkArgument(StringUtils.isNotBlank(document.getId())); List<AffMatchAffiliation> affMatchAffiliations = new ArrayList<>(); if (CollectionUtils.isEmpty(document.getAffiliations())) { return affMatchAffiliations; } for (int i = 0; i < document.getAffiliations().size(); i++) { Affiliation srcAffiliation = document.getAffiliations().get(i); if (isAuthorAffiliation(i, document.getAuthors())) { affMatchAffiliations.add(convertAffiliation(document.getId(), i + 1, srcAffiliation)); } } return affMatchAffiliations; }  List<AffMatchAffiliation> convert(ExtractedDocumentMetadata document);  }