@Test public void convert_not_approved() throws IOException { Publication oafEntity = documentEntity(); when(fieldApprover.approve(any())).thenReturn(false); DocumentMetadata metadata = converter.convert(oafEntity); assertEquals(ID, metadata.getId()); assertEquals(null, metadata.getTitle()); assertEquals(null, metadata.getAbstract$()); assertEquals(LANGUAGE, metadata.getLanguage()); assertEquals(null, metadata.getKeywords()); assertEquals(null, metadata.getExternalIdentifiers()); assertEquals(null, metadata.getJournal()); assertEquals(null, metadata.getYear()); assertEquals(null, metadata.getPublisher()); assertTrue(metadata.getPublicationType().getArticle()); assertTrue(metadata.getPublicationType().getDataset()); assertEquals(DATASOURCE_IDS, metadata.getDatasourceIds()); assertEquals(1, metadata.getAuthors().size()); assertEquals(FIRST_NAME, metadata.getAuthors().get(0).getName()); assertEquals(SECOND_NAME + ' ' + SECOND_SECOND_NAME, metadata.getAuthors().get(0).getSurname()); assertEquals(FULL_NAME, metadata.getAuthors().get(0).getFullname()); }
@Override public DocumentMetadata convert(Result result) throws IOException { Preconditions.checkNotNull(result); DocumentMetadata.Builder builder = DocumentMetadata.newBuilder(); builder.setId(result.getId()); createBasicMetadata(result, builder); handleAdditionalIds(result, builder); handleDatasourceIds(result, builder); handlePersons(result, builder); return builder.build(); }
DocumentMetadataConverter implements OafEntityToAvroConverter<Result, DocumentMetadata> { @Override public DocumentMetadata convert(Result result) throws IOException { Preconditions.checkNotNull(result); DocumentMetadata.Builder builder = DocumentMetadata.newBuilder(); builder.setId(result.getId()); createBasicMetadata(result, builder); handleAdditionalIds(result, builder); handleDatasourceIds(result, builder); handlePersons(result, builder); return builder.build(); } }
DocumentMetadataConverter implements OafEntityToAvroConverter<Result, DocumentMetadata> { @Override public DocumentMetadata convert(Result result) throws IOException { Preconditions.checkNotNull(result); DocumentMetadata.Builder builder = DocumentMetadata.newBuilder(); builder.setId(result.getId()); createBasicMetadata(result, builder); handleAdditionalIds(result, builder); handleDatasourceIds(result, builder); handlePersons(result, builder); return builder.build(); } DocumentMetadataConverter(FieldApprover fieldApprover); }
DocumentMetadataConverter implements OafEntityToAvroConverter<Result, DocumentMetadata> { @Override public DocumentMetadata convert(Result result) throws IOException { Preconditions.checkNotNull(result); DocumentMetadata.Builder builder = DocumentMetadata.newBuilder(); builder.setId(result.getId()); createBasicMetadata(result, builder); handleAdditionalIds(result, builder); handleDatasourceIds(result, builder); handlePersons(result, builder); return builder.build(); } DocumentMetadataConverter(FieldApprover fieldApprover); @Override DocumentMetadata convert(Result result); }
DocumentMetadataConverter implements OafEntityToAvroConverter<Result, DocumentMetadata> { @Override public DocumentMetadata convert(Result result) throws IOException { Preconditions.checkNotNull(result); DocumentMetadata.Builder builder = DocumentMetadata.newBuilder(); builder.setId(result.getId()); createBasicMetadata(result, builder); handleAdditionalIds(result, builder); handleDatasourceIds(result, builder); handlePersons(result, builder); return builder.build(); } DocumentMetadataConverter(FieldApprover fieldApprover); @Override DocumentMetadata convert(Result result);  }