summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorreger <reger18@arcor.de>2016-10-06 23:37:12 +0200
committerreger <reger18@arcor.de>2016-10-06 23:37:12 +0200
commitb752bcfecba1b541f69d3ecb1129c66a2213e2a4 (patch)
tree45491679fa74ab07313f68dd3362b563ddfc08d1 /test
parentb017e9742122c23646531934bcfd2b5b07e00da0 (diff)
adjust date in text detection to ignore some program version strings
like "3.1.2.0102" see http://mantis.tokeek.de/view.php?id=650 + expand test case
Diffstat (limited to 'test')
-rw-r--r--test/java/net/yacy/document/DateDetectionTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/java/net/yacy/document/DateDetectionTest.java b/test/java/net/yacy/document/DateDetectionTest.java
index cedcea6de..eba322d7a 100644
--- a/test/java/net/yacy/document/DateDetectionTest.java
+++ b/test/java/net/yacy/document/DateDetectionTest.java
@@ -28,6 +28,9 @@ public class DateDetectionTest {
testtext.add("1.1.2016");
testtext.add("1. Januar 2016");
testtext.add("2016, January 1.");
+
+ testtext.add("beginning text 1.1.2016");
+ testtext.add("line break\n1.1.2016");
for (String text : testtext) {
Date d = DateDetection.parseLine(text, 0);
@@ -82,4 +85,23 @@ public class DateDetectionTest {
}
}
+ /**
+ * Negative test of parseLine method, of class DateDetection
+ * with cases that represent NOT a date
+ */
+ @Test
+ public void testParseLineNoDate() {
+
+ // test input representations
+ Set<String> testtext = new LinkedHashSet();
+ testtext.add("3.1.2.0102"); // example of a program version string
+ // testtext.add("3.1.20.0102"); // date end-capture not working (on modification conflict with YMD parser)
+ testtext.add("v3.1.21");
+ testtext.add("v3.1.22.");
+
+ for (String text : testtext) {
+ Date d = DateDetection.parseLine(text, 0);
+ assertNull("not a date: " + text, d);
+ }
+ }
}