2023-04-28 10:53:24 +02:00
|
|
|
package eu.dnetlib.dhp.schema.oaf;
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
2023-04-28 11:22:45 +02:00
|
|
|
import org.junit.jupiter.api.Assertions;
|
2023-04-28 10:53:24 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
public class RelationTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void checkExistRelType() {
|
|
|
|
assertTrue(Relation.SUBRELTYPE.exists(Relation.SUBRELTYPE.dedup.toString()));
|
|
|
|
assertFalse(Relation.SUBRELTYPE.exists("foo"));
|
|
|
|
|
|
|
|
}
|
|
|
|
@Test
|
2023-04-28 11:22:45 +02:00
|
|
|
public void checkSubRelType() {
|
2023-04-28 10:53:24 +02:00
|
|
|
Relation.RELCLASS rc = Relation.RELCLASS.merges;
|
|
|
|
assertEquals(Relation.SUBRELTYPE.dedup, rc.getSubRel());
|
|
|
|
|
|
|
|
for (Relation.RELCLASS value : Relation.RELCLASS.values()) {
|
|
|
|
System.out.printf("%s => %s\n", value, value.getSubRel());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-28 11:22:45 +02:00
|
|
|
@Test
|
|
|
|
public void lookRelClassUpTest() {
|
|
|
|
Assertions.assertEquals(Relation.RELCLASS.Compiles, Relation.RELCLASS.lookUp("compiles"));
|
|
|
|
Assertions.assertEquals(Relation.RELCLASS.IsMetadataFor, Relation.RELCLASS.lookUp("isMetaDATAFOr"));
|
|
|
|
Assertions.assertThrows(IllegalArgumentException.class, () -> Relation.RELCLASS.lookUp("hello"));
|
|
|
|
}
|
|
|
|
|
2023-04-28 10:53:24 +02:00
|
|
|
}
|