From 9cc24a40509f62b789ff1fa97913bef32589a288 Mon Sep 17 00:00:00 2001 From: Ellen Spertus Date: Wed, 22 Aug 2018 12:56:06 -0700 Subject: Added more tests of GrobidScorable.keepRecord --- scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala b/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala index 620998e..6c45cc5 100644 --- a/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala +++ b/scalding/src/test/scala/sandcrawler/GrobidScorableTest.scala @@ -58,6 +58,7 @@ class GrobidScorableTest extends FlatSpec with Matchers { } """ val GrobidStringWithGoodTitle = GrobidString.replace("<>", "Dummy Example File") + val GrobidStringWithMaximumTitle = GrobidString.replace("<<TITLE>>", "T" * Scorable.MaxTitleLength) val GrobidStringWithExcessiveTitle = GrobidString.replace("<<TITLE>>", "T" * Scorable.MaxTitleLength + "0") val GrobidStringWithNullTitle = GrobidString.replace("\"<<TITLE>>\"", "null") val GrobidStringWithoutTitle = GrobidString.replace("title", "nottitle") @@ -97,6 +98,10 @@ class GrobidScorableTest extends FlatSpec with Matchers { GrobidScorable.keepRecord(GrobidStringWithGoodTitle) shouldBe true } + it should "return true for valid JSON with a title of maximum permitted length" in { + GrobidScorable.keepRecord(GrobidStringWithMaximumTitle) shouldBe true + } + it should "return false for valid JSON with excessively long title" in { GrobidScorable.keepRecord(GrobidStringWithExcessiveTitle) shouldBe false } -- cgit v1.2.3