2020-04-07 11:56:22 +02:00
|
|
|
package eu.dnetlib.dhp.schema.common;
|
2020-04-01 18:39:26 +02:00
|
|
|
|
2020-04-18 12:42:58 +02:00
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
|
2020-04-01 18:39:26 +02:00
|
|
|
import eu.dnetlib.dhp.schema.oaf.OafEntity;
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.Relation;
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.Result;
|
|
|
|
import org.junit.jupiter.api.Nested;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
public class ModelSupportTest {
|
|
|
|
|
|
|
|
@Nested
|
|
|
|
class IsSubClass {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() {
|
|
|
|
// when
|
|
|
|
Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class);
|
|
|
|
|
|
|
|
// then
|
|
|
|
assertFalse(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void shouldReturnTrueWhenSubClassExtendsSuperClass() {
|
|
|
|
// when
|
|
|
|
Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class);
|
|
|
|
|
|
|
|
// then
|
|
|
|
assertTrue(result);
|
|
|
|
}
|
|
|
|
}
|
2020-04-18 12:42:58 +02:00
|
|
|
}
|