diff options
author | Ellen Spertus <ellen.spertus@gmail.com> | 2018-08-11 21:03:53 -0700 |
---|---|---|
committer | Ellen Spertus <ellen.spertus@gmail.com> | 2018-08-11 21:03:53 -0700 |
commit | 728e50a33cec921c9a624439f2e1c8561a6e12ce (patch) | |
tree | 671548fe0e4bd38badb76453c0a1a90dea5e0ce7 /scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala | |
parent | 768e7ef0d127cf55119543be6e656751704ca5b2 (diff) | |
download | sandcrawler-728e50a33cec921c9a624439f2e1c8561a6e12ce.tar.gz sandcrawler-728e50a33cec921c9a624439f2e1c8561a6e12ce.zip |
It compiles.
Diffstat (limited to 'scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala')
-rw-r--r-- | scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala b/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala index 7777610..5bb955a 100644 --- a/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala +++ b/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala @@ -60,18 +60,15 @@ class GrobidScorableTest extends FlatSpec with Matchers { // Unit tests - "grobidToSlug()" should "get the right slug for a grobid json string" in { - val slug = GrobidScorable.grobidToSlug(GrobidStringWithTitle) - slug should contain ("dummy example file") + "GrobidScorable.jsonToMapFeatures()" should "handle invalid JSON" in { + val result = GrobidScorable.jsonToMapFeatures(MalformedGrobidString) shouldBe None + result.slug shouldBe Scorable.NoSlug + result.json shouldBe MalformedGrobidString } - it should "return None if given json string without title" in { - val slug = GrobidScorable.grobidToSlug(GrobidStringWithoutTitle) - slug shouldBe None - } - - it should "return None if given a malformed json string" in { - val slug = GrobidScorable.grobidToSlug(MalformedGrobidString) - slug shouldBe None + "GrobidScorable.jsonToMapFeatures()" should "handle missing title" in { + val result = GrobidScorable.jsonToMapFeatures(GrobidStringWithoutTitle) shouldBe None + result.slug shouldBe Scorable.NoSlug + result.json shouldBe GrobidStringWithoutTitle } } |