Added some tests to make sure a workaround is not in charge anymore
Change-Id: Id593fb4ea9e8293c5fba22a92c67c58d8cf586ac
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
index e8fa3f8..0068ac9 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
@@ -106,6 +106,30 @@
@Test
+ public void collectionWithSpecialcharacter () {
+ String query = _getJSONString("collection_with_special_char.jsonld");
+ Krill ks = new Krill(query);
+ assertFalse(ks.hasErrors());
+ assertFalse(ks.hasWarnings());
+ assertFalse(ks.hasMessages());
+ assertEquals("QueryWrapperFilter(author:/Goe:th=e/)", ks.getCollection().toString());
+ };
+
+
+ @Test
+ public void collectionWithWorkaroundSharp () {
+
+ // This test should fail, when a ugly workaround is in charge!
+ String query = _getJSONString("collection_with_sharp.jsonld");
+ Krill ks = new Krill(query);
+ assertFalse(ks.hasErrors());
+ assertFalse(ks.hasWarnings());
+ assertFalse(ks.hasMessages());
+ assertEquals("QueryWrapperFilter(author:/Goe#the/)", ks.getCollection().toString());
+ };
+
+
+ @Test
public void nocollectiontypegiven () {
String metaQuery = _getJSONString("multiterm_rewrite_collection.jsonld");
KrillCollection kc = new KrillCollection(metaQuery);
diff --git a/src/test/resources/queries/collections/collection_with_sharp.jsonld b/src/test/resources/queries/collections/collection_with_sharp.jsonld
new file mode 100644
index 0000000..18e8bc8
--- /dev/null
+++ b/src/test/resources/queries/collections/collection_with_sharp.jsonld
@@ -0,0 +1,26 @@
+{
+ "@context":"http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
+ "errors":[],
+ "warnings":[],
+ "messages":[],
+ "query":{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "layer":"orth",
+ "key":"der",
+ "match":"match:eq",
+ "foundry":"opennlp"
+ }
+ },
+ "collection":{
+ "value":"Goe#the",
+ "match":"match:eq",
+ "type":"type:regex",
+ "key":"author",
+ "@type":"koral:doc"
+ },
+ "meta":{
+ "cutOff":null
+ }
+}
diff --git a/src/test/resources/queries/collections/collection_with_special_char.jsonld b/src/test/resources/queries/collections/collection_with_special_char.jsonld
new file mode 100644
index 0000000..df63afa
--- /dev/null
+++ b/src/test/resources/queries/collections/collection_with_special_char.jsonld
@@ -0,0 +1,26 @@
+{
+ "@context":"http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
+ "errors":[],
+ "warnings":[],
+ "messages":[],
+ "query":{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "layer":"orth",
+ "key":"der",
+ "match":"match:eq",
+ "foundry":"opennlp"
+ }
+ },
+ "collection":{
+ "value":"Goe:th=e",
+ "match":"match:eq",
+ "type":"type:regex",
+ "key":"author",
+ "@type":"koral:doc"
+ },
+ "meta":{
+ "cutOff":null
+ }
+}