From 1299bfb35708bd00088255bc9984b6dc66764bec Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Wed, 30 Jun 2021 12:53:27 +0200 Subject: [PATCH] Added class to test the normalization of doi --- .../dhp/doiboost/NormalizeDoiTest.scala | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/NormalizeDoiTest.scala diff --git a/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/NormalizeDoiTest.scala b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/NormalizeDoiTest.scala new file mode 100644 index 000000000..a9a841ee9 --- /dev/null +++ b/dhp-workflows/dhp-doiboost/src/test/java/eu/dnetlib/dhp/doiboost/NormalizeDoiTest.scala @@ -0,0 +1,46 @@ +package eu.dnetlib.dhp.doiboost + +import eu.dnetlib.doiboost.DoiBoostMappingUtil +import org.junit.jupiter.api.Test + +class NormalizeDOITest { + + @Test + def doiDSLowerCase():Unit = { + val doi ="10.1042/BCJ20160876" + + assert(DoiBoostMappingUtil.normalizeDoi(doi).equals(doi.toLowerCase())) + + } + + + @Test + def doiFiltered():Unit = { + val doi = "0.1042/BCJ20160876" + + assert(DoiBoostMappingUtil.normalizeDoi(doi) == null) + } + + @Test + def doiFiltered2():Unit = { + val doi = "https://doi.org/0.1042/BCJ20160876" + + assert(DoiBoostMappingUtil.normalizeDoi(doi) == null) + } + + + @Test + def doiCleaned():Unit = { + val doi = "https://doi.org/10.1042/BCJ20160876" + + assert(DoiBoostMappingUtil.normalizeDoi(doi).equals("10.1042/BCJ20160876".toLowerCase())) + } + + @Test + def doiCleaned1():Unit = { + val doi = "https://doi.org/10.1042/ BCJ20160876" + + assert(DoiBoostMappingUtil.normalizeDoi(doi).equals("10.1042/BCJ20160876".toLowerCase())) + } + +} \ No newline at end of file