From 70f3bc389f76d3fab76a67329c59891ae0f2804f Mon Sep 17 00:00:00 2001 From: Ellen Spertus Date: Sat, 28 Jul 2018 15:41:43 -0700 Subject: Added tests (both pass) to try to understand crash when run on real datwa. --- scalding/src/test/scala/sandcrawler/HBaseCrossrefScoreTest.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scalding') diff --git a/scalding/src/test/scala/sandcrawler/HBaseCrossrefScoreTest.scala b/scalding/src/test/scala/sandcrawler/HBaseCrossrefScoreTest.scala index e6211a2..e4cab95 100644 --- a/scalding/src/test/scala/sandcrawler/HBaseCrossrefScoreTest.scala +++ b/scalding/src/test/scala/sandcrawler/HBaseCrossrefScoreTest.scala @@ -126,6 +126,10 @@ class HBaseCrossrefScoreTest extends FlatSpec with Matchers { slug should contain ("hello there") } + it should "return None if given empty string" in { + HBaseCrossrefScore.titleToSlug("") shouldBe None + } + "grobidToSlug()" should "get the right slug for a grobid json string" in { val slug = HBaseCrossrefScore.grobidToSlug(GrobidStringWithTitle) slug should contain ("dummy example file") @@ -141,6 +145,11 @@ class HBaseCrossrefScoreTest extends FlatSpec with Matchers { slug shouldBe None } + it should "return None if given an empty json string" in { + val slug = HBaseCrossrefScore.grobidToSlug("") + slug shouldBe None + } + "crossrefToSlug()" should "get the right slug for a crossref json string" in { val slug = HBaseCrossrefScore.crossrefToSlug(CrossrefStringWithTitle) slug should contain ("sometitle") -- cgit v1.2.3