From 149f85ddf59f1e13faf2ca63b1bdfd3609b40459 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Wed, 30 Jun 2021 13:00:52 +0200 Subject: [PATCH] added tests for the normalization of the dois --- .../orcid/MappingORCIDToOAFTest.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala index cdda3b2af..7628fb853 100644 --- a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala +++ b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/doiboost/orcid/MappingORCIDToOAFTest.scala @@ -12,6 +12,8 @@ import org.slf4j.{Logger, LoggerFactory} import java.nio.file.Path import scala.io.Source +import scala.collection.JavaConversions._ + class MappingORCIDToOAFTest { val logger: Logger = LoggerFactory.getLogger(ORCIDToOAF.getClass) val mapper = new ObjectMapper() @@ -63,9 +65,26 @@ class MappingORCIDToOAFTest { } + @Test + def testExtractDat1():Unit ={ + val aList: List[OrcidAuthor] = List(OrcidAuthor("0000-0002-4335-5309", Some("Lucrecia"), Some("Curto"), null, null, null ), + OrcidAuthor("0000-0001-7501-3330", Some("Emilio"), Some("Malchiodi"), null, null, null ), OrcidAuthor("0000-0002-5490-9186", Some("Sofia"), Some("Noli Truant"), null, null, null )) + + val orcid:ORCIDItem = ORCIDItem("10.1042/BCJ20160876", aList) + + val oaf = ORCIDToOAF.convertTOOAF(orcid) + assert(oaf.getPid.size() == 1) + oaf.getPid.toList.foreach(pid => assert(pid.getQualifier.getClassid.equals("doi"))) + oaf.getPid.toList.foreach(pid => assert(pid.getValue.equals("10.1042/BCJ20160876".toLowerCase()))) + //println(mapper.writeValueAsString(ORCIDToOAF.convertTOOAF(orcid))) + + + } + + }