aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala')
-rw-r--r--scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala b/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala
index f598cae..c0d1cb0 100644
--- a/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala
+++ b/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala
@@ -98,6 +98,24 @@ class CrossrefScorableTest extends FlatSpec with Matchers {
result.slug shouldBe Scorable.NoSlug
}
+ it should "handle subtitle" in {
+ val result = CrossrefScorable.jsonToMapFeatures(
+ """{"title": ["short but not too short"], "subtitle": ["just right!"], "DOI": "10.123/asdf", "type":"journal-article", "author":[{ "given" : "W", "family" : "Gaier"}]}""")
+ result.slug shouldBe "shortbutnottooshortjustright"
+ }
+
+ it should "handle empty subtitle" in {
+ val result = CrossrefScorable.jsonToMapFeatures(
+ """{"title": ["short but not too short"], "subtitle": [""], "DOI": "10.123/asdf", "type":"journal-article", "author":[{ "given" : "W", "family" : "Gaier"}]}""")
+ result.slug shouldBe "shortbutnottooshort"
+ }
+
+ it should "handle null subtitle" in {
+ val result = CrossrefScorable.jsonToMapFeatures(
+ """{"title": ["short but not too short"], "subtitle": [null], "DOI": "10.123/asdf", "type":"journal-article", "author":[{ "given" : "W", "family" : "Gaier"}]}""")
+ result.slug shouldBe "shortbutnottooshort"
+ }
+
it should "handle missing authors" in {
val result = CrossrefScorable.jsonToMapFeatures(CrossrefStringWithNoAuthors)
result.slug shouldBe Scorable.NoSlug