[APC at the result level] added other test
This commit is contained in:
parent
2895988f2b
commit
91af2dade8
|
@ -162,7 +162,11 @@ class MergeTest {
|
|||
|
||||
p1.mergeFrom(p2);
|
||||
|
||||
assertEquals("1721.47", p1.getProcessingchargeamount().getValue());
|
||||
assertEquals("EUR", p1.getProcessingchargecurrency().getValue());
|
||||
|
||||
assertEquals(2 , p1.getInstance().size());
|
||||
|
||||
p1.getInstance().stream().forEach(i -> assertTrue(i.getProcessingchargeamount() != null));
|
||||
p1.getInstance().stream().forEach(i -> assertTrue(i.getProcessingchargecurrency() != null));
|
||||
|
||||
|
@ -173,7 +177,35 @@ class MergeTest {
|
|||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency().getValue().equals("USD"));
|
||||
System.out.println(new ObjectMapper().writeValueAsString(p1));
|
||||
}
|
||||
@Test
|
||||
void testAPCMerge2() throws Exception {
|
||||
List<Result> publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publication_apc2.json", Publication.class);
|
||||
System.out.println(publications.size());
|
||||
publications.forEach(p -> assertEquals(1, p.getInstance().size()));
|
||||
assertTrue(publications.get(0).getProcessingchargeamount() != null );
|
||||
assertTrue(publications.get(0).getProcessingchargecurrency() != null );
|
||||
assertTrue(publications.get(1).getProcessingchargeamount() == null );
|
||||
|
||||
Result p1 = publications.get(1);
|
||||
Result p2 = publications.get(0);
|
||||
|
||||
p1.mergeFrom(p2);
|
||||
|
||||
assertEquals("1721.47", p1.getProcessingchargeamount().getValue());
|
||||
assertEquals("EUR", p1.getProcessingchargecurrency().getValue());
|
||||
|
||||
assertEquals(2 , p1.getInstance().size());
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount() != null);
|
||||
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency() != null);
|
||||
|
||||
assertEquals("1721.47", p1.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargeamount().getValue());
|
||||
|
||||
assertEquals("EUR", p1.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargecurrency().getValue());
|
||||
System.out.println(new ObjectMapper().writeValueAsString(p1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test enrichment function.
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue