1
0
Fork 0

adapted RorActionSet test, it should not create parent/child rels

This commit is contained in:
Claudio Atzori 2022-07-25 17:54:10 +02:00
parent 3c23d634eb
commit d43663d30f
1 changed files with 9 additions and 13 deletions

View File

@ -2,6 +2,7 @@
package eu.dnetlib.dhp.actionmanager.ror; package eu.dnetlib.dhp.actionmanager.ror;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.List; import java.util.List;
@ -38,25 +39,20 @@ class GenerateRorActionSetJobTest {
.readValue(IOUtils.toString(getClass().getResourceAsStream("ror_org.json")), RorOrganization.class); .readValue(IOUtils.toString(getClass().getResourceAsStream("ror_org.json")), RorOrganization.class);
final List<AtomicAction<? extends Oaf>> aas = GenerateRorActionSetJob.convertRorOrg(r); final List<AtomicAction<? extends Oaf>> aas = GenerateRorActionSetJob.convertRorOrg(r);
Assertions.assertEquals(3, aas.size()); Assertions.assertEquals(1, aas.size());
assertEquals(Organization.class, aas.get(0).getClazz()); assertEquals(Organization.class, aas.get(0).getClazz());
assertEquals(Relation.class, aas.get(1).getClazz());
assertEquals(Relation.class, aas.get(2).getClazz());
final Organization o = (Organization) aas.get(0).getPayload(); final Organization o = (Organization) aas.get(0).getPayload();
final Relation r1 = (Relation) aas.get(1).getPayload();
final Relation r2 = (Relation) aas.get(2).getPayload();
assertEquals(o.getId(), r1.getSource()); assertNotNull(o);
assertEquals(r1.getSource(), r2.getTarget());
assertEquals(r2.getSource(), r1.getTarget()); assertNotNull(o.getCountry());
assertEquals(ModelConstants.IS_PARENT_OF, r1.getRelClass()); assertEquals("AU", o.getCountry().getClassid());
assertEquals(ModelConstants.IS_CHILD_OF, r2.getRelClass());
assertNotNull(o.getLegalname());
assertEquals("Mount Stromlo Observatory", o.getLegalname().getValue());
System.out.println(mapper.writeValueAsString(o)); System.out.println(mapper.writeValueAsString(o));
System.out.println(mapper.writeValueAsString(r1));
System.out.println(mapper.writeValueAsString(r2));
} }
@Test @Test