Added null pointer test for html serialization of dependency annotations
Change-Id: I91fc69f2de10c33951d4ea645497020e5a724b1d
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
index 8547f1c..da683a7 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSampleIndex.java
@@ -30,6 +30,7 @@
import de.ids_mannheim.korap.query.SpanMultipleDistanceQuery;
import de.ids_mannheim.korap.query.wrap.SpanQueryWrapper;
import de.ids_mannheim.korap.response.Result;
+import de.ids_mannheim.korap.response.Match;
import de.ids_mannheim.korap.util.QueryException;
public class TestSampleIndex {
@@ -174,7 +175,6 @@
}
-
@Test
public void testWildcardStarWithCollection () throws IOException {
@@ -225,5 +225,29 @@
+ "[[meine enge Erfahrung]] hinaus, nach ähnlichen Fällen "
+ "in der ...", kr.getMatch(3).getSnippetBrackets());
}
-
+
+ @Test
+ public void testMatchWithDependency () throws IOException, QueryException {
+ // /GOE/AGA/01784/p104-105/matchInfo?layer=c&foundry=corenlp&spans=true
+ Match km = sample.getMatchInfo("match-GOE/AGD/00000-p132566-132569",
+ "tokens",
+ "corenlp",
+ "c",
+ true,
+ true);
+
+ assertEquals(km.getSnippetBrackets(), "... [[meine eigne Erfahrung]] ...");
+ assertEquals(km.getSnippetHTML(), "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark>meine eigne Erfahrung</mark></span><span class=\"context-right\"><span class=\"more\"></span></span>");
+
+ km = sample.getMatchInfo("match-GOE/AGD/00000-p132566-132569",
+ "tokens",
+ "malt",
+ "d",
+ true,
+ true);
+
+ assertEquals(km.getSnippetBrackets(), "... [[{malt/d:DET>132567:meine} {#132567:{malt/d:ATTR>132567:eigne}} {malt/d:PN>132564:Erfahrung}]] ...");
+ assertEquals(km.getSnippetHTML(), "... [[{malt/d:DET>132567:meine} {#132567:{malt/d:ATTR>132567:eigne}} {malt/d:PN>132564:Erfahrung}]] ...");
+
+ }
}