From a3bf1d47fac53b818a8118020adced6c54be7cba Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 15 Aug 2018 20:22:44 -0700 Subject: crossref: test for empty-string title --- scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scalding') diff --git a/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala b/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala index e171dba..1789d1a 100644 --- a/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala +++ b/scalding/src/test/scala/sandcrawler/CrossrefScorableTest.scala @@ -67,6 +67,7 @@ class CrossrefScorableTest extends FlatSpec with Matchers { """ // scalastyle:on val CrossrefStringWithTitle = CrossrefString.replace("<>", "Some Title") + val CrossrefStringWithEmptyTitle = CrossrefString.replace("<<TITLE>>", "") val CrossrefStringWithoutTitle = CrossrefString.replace("title", "nottitle") val MalformedCrossrefString = CrossrefString.replace("}", "") @@ -81,6 +82,11 @@ class CrossrefScorableTest extends FlatSpec with Matchers { result.slug shouldBe Scorable.NoSlug } + it should "handle empty title" in { + val result = CrossrefScorable.jsonToMapFeatures(CrossrefStringWithEmptyTitle) + result.slug shouldBe Scorable.NoSlug + } + it should "handle valid input" in { val result = CrossrefScorable.jsonToMapFeatures(CrossrefStringWithTitle) result.slug shouldBe "sometitle" -- cgit v1.2.3