Added wildcard bug test for Cosmas2

Change-Id: I9049661eb7be44f25f162ebb5a4d03c393ae45ed
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
index 81c9744..fe65edf 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -388,6 +388,20 @@
         assertEquals(sqwi.toQuery().toString(),"spanNext(tokens:s:der, spanExpansion(tokens:s:Mann, !tokens:tt/p:ADJA{0, 100}, left, class:1))");
     };
 
+	@Test
+    public void queryJSONcosmas2Bug () throws QueryException {
+
+        SpanQueryWrapper sqwi = getJSONQuery(getClass().getResource("/queries/bugs/cosmas_wildcards.jsonld").getFile());
+
+        // meine* /+w1:2,s0 &Erfahrung
+        assertEquals(sqwi.toQuery().toString(),"spanMultipleDistance({129: SpanMultiTermQueryWrapper(tokens:s:meine*)}, "+
+					 "{129: tokens:l:Erfahrung}, "+
+					 "[(w[1:2], ordered, notExcluded), "+
+					 "(base/s:s[0:0], ordered, notExcluded)])");
+    };
+
+
+	
 
     // get query wrapper based on json file
     public SpanQueryWrapper jsonQueryFile (String filename) throws QueryException {
diff --git a/src/test/resources/queries/bugs/cosmas_wildcards.jsonld b/src/test/resources/queries/bugs/cosmas_wildcards.jsonld
new file mode 100644
index 0000000..2e1557a
--- /dev/null
+++ b/src/test/resources/queries/bugs/cosmas_wildcards.jsonld
@@ -0,0 +1,63 @@
+{
+  "@context":"http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
+  "query":{
+    "operation":"operation:sequence",
+    "operands":[
+      {
+        "operation":"operation:class",
+        "operands":[
+          {
+            "wrap":{
+              "@type":"koral:term",
+              "layer":"orth",
+              "match":"match:eq",
+              "type":"type:wildcard",
+              "key":"meine*"
+            },
+            "@type":"koral:token"
+          }
+        ],
+        "@type":"koral:group",
+        "classOut":129
+      },
+      {
+        "operation":"operation:class",
+        "operands":[
+          {
+            "wrap":{
+              "@type":"koral:term",
+              "layer":"lemma",
+              "match":"match:eq",
+              "key":"Erfahrung"
+            },
+            "@type":"koral:token"
+          }
+        ],
+        "@type":"koral:group",
+        "classOut":129
+      }
+    ],
+    "inOrder":true,
+    "@type":"koral:group",
+    "distances":[
+      {
+        "@type":"cosmas:distance",
+        "boundary":{
+          "min":1,
+          "max":2,
+          "@type":"koral:boundary"
+        },
+        "key":"w"
+      },
+      {
+        "@type":"cosmas:distance",
+        "boundary":{
+          "min":0,
+          "max":0,
+          "@type":"koral:boundary"
+        },
+        "key":"s"
+      }
+    ]
+  }
+}