Added flag serialization bug test
Change-Id: I32efc9355b8d6ba057fa5f6d36b611dfde5a8141
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
index 520a3a0..85161ab 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
@@ -91,6 +91,8 @@
assertEquals("Warning", kr.hasWarnings(), true);
assertEquals("Warning text", kr.getWarning(0).getMessage(),
"Flag is unknown");
+ assertEquals("Warning text", kr.getWarning(0).toJsonString(),
+ "[748,\"Flag is unknown\",\"caseInsensitive\"]");
// Negation of segment
kr = ki.search(new Krill(
@@ -100,6 +102,17 @@
assertEquals("Warning", kr.hasWarnings(), true);
assertEquals("Warning text", kr.getWarning(0).getMessage(),
"Exclusivity of query is ignored");
+
+ // Flag parameter injection
+ kr = ki.search(new Krill(
+ "{\"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"key\" : \"a\", \"flags\" : [{ \"injection\" : true }], \"layer\" : \"orth\", \"match\" : \"match:ne\" }}}"));
+
+ assertEquals("totalResults", kr.getTotalResults(), 6);
+ assertEquals("Warning", kr.hasWarnings(), true);
+ assertEquals("Warning text", kr.getWarning(0).getMessage(),
+ "Flag is unknown");
+ assertEquals("Warning text", kr.getWarning(0).toJsonString(),
+ "[748,\"Flag is unknown\"]");
};