updated mapping tests as consequence of the special treatment reserved to Handle PIDs

This commit is contained in:
Claudio Atzori 2021-03-23 09:37:48 +01:00
parent 431cbe9955
commit b4febed138
1 changed files with 11 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import eu.dnetlib.dhp.schema.oaf.utils.PidType;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
@ -396,11 +397,10 @@ public class MappersTest {
assertEquals(1, d.getAuthor().size()); assertEquals(1, d.getAuthor().size());
assertEquals(1, d.getSubject().size()); assertEquals(1, d.getSubject().size());
assertEquals(1, d.getInstance().size()); assertEquals(1, d.getInstance().size());
assertTrue(d.getPid().isEmpty()); assertNotNull(d.getPid());
assertEquals(1, d.getPid().size());
assertTrue(d.getInstance().get(0).getPid().isEmpty()); assertTrue(PidType.isValid(d.getPid().get(0).getQualifier().getClassid()));
assertEquals(1, d.getInstance().get(0).getAlternateIdentifier().size()); assertEquals(PidType.handle, PidType.valueOf(d.getPid().get(0).getQualifier().getClassid()));
assertEquals("handle", d.getInstance().get(0).getAlternateIdentifier().get(0).getQualifier().getClassid());
assertNotNull(d.getInstance().get(0).getUrl()); assertNotNull(d.getInstance().get(0).getUrl());
} }
@ -451,7 +451,10 @@ public class MappersTest {
assertEquals(1, p.getAuthor().size()); assertEquals(1, p.getAuthor().size());
assertEquals("OPEN", p.getBestaccessright().getClassid()); assertEquals("OPEN", p.getBestaccessright().getClassid());
assertTrue(p.getPid().isEmpty()); assertTrue(p.getPid().size() == 1);
assertTrue(PidType.isValid(p.getPid().get(0).getQualifier().getClassid()));
assertTrue(PidType.handle.equals(PidType.valueOf(p.getPid().get(0).getQualifier().getClassid())));
assertEquals("hdl:11858/00-1734-0000-0003-EE73-2", p.getPid().get(0).getValue());
assertEquals("dataset", p.getResulttype().getClassname()); assertEquals("dataset", p.getResulttype().getClassname());
assertEquals(1, p.getInstance().size()); assertEquals(1, p.getInstance().size());
assertEquals("OPEN", p.getInstance().get(0).getAccessright().getClassid()); assertEquals("OPEN", p.getInstance().get(0).getAccessright().getClassid());
@ -461,11 +464,8 @@ public class MappersTest {
"http://creativecommons.org/licenses/by/3.0/de/legalcode", p.getInstance().get(0).getLicense().getValue()); "http://creativecommons.org/licenses/by/3.0/de/legalcode", p.getInstance().get(0).getLicense().getValue());
assertEquals(1, p.getInstance().size()); assertEquals(1, p.getInstance().size());
assertEquals(1, p.getInstance().get(0).getAlternateIdentifier().size()); assertNotNull(p.getInstance().get(0).getAlternateIdentifier());
assertEquals("handle", p.getInstance().get(0).getAlternateIdentifier().get(0).getQualifier().getClassid()); assertEquals(0, p.getInstance().get(0).getAlternateIdentifier().size());
assertEquals(
"hdl:11858/00-1734-0000-0003-EE73-2", p.getInstance().get(0).getAlternateIdentifier().get(0).getValue());
assertEquals(1, p.getInstance().get(0).getUrl().size()); assertEquals(1, p.getInstance().get(0).getUrl().size());
} }