Added payload in skipTo() in ClassSpans, 
added a testcase for the ticket #142
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
new file mode 100644
index 0000000..5d3e0b5
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
@@ -0,0 +1,73 @@
+package de.ids_mannheim.korap.highlight;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import de.ids_mannheim.korap.KorapIndex;
+import de.ids_mannheim.korap.KorapQuery;
+import de.ids_mannheim.korap.KorapResult;
+import de.ids_mannheim.korap.KorapSearch;
+import de.ids_mannheim.korap.query.SpanNextQuery;
+import de.ids_mannheim.korap.query.wrap.SpanQueryWrapper;
+import de.ids_mannheim.korap.util.QueryException;
+
+
+public class TestClass {
+	KorapIndex ki;
+	KorapResult kr;
+	KorapSearch ks;
+	
+	@Test
+	public void queryJSONpoly1() throws QueryException, IOException {
+		
+		String jsonPath = getClass().getResource("/queries/poly1.json").getFile();
+		String jsonQuery = readFile(jsonPath);
+		SpanQueryWrapper sqwi = new KorapQuery("tokens").fromJSON(
+				jsonQuery
+		);
+		
+		SpanNextQuery sq = (SpanNextQuery) sqwi.toQuery();
+		//System.out.println(sq.toString());
+		
+		ki = new KorapIndex();
+	    ki.addDocFile(
+	    	getClass().getResource("/wiki/JJJ-00785.json.gz").getFile(),true);
+	    ki.addDocFile(
+		        getClass().getResource("/wiki/DDD-01402.json.gz").getFile(),true);
+		ki.commit();
+		kr = ki.search(sq, (short) 10);
+
+		assertEquals(61, kr.getMatch(0).getStartPos());
+		assertEquals(64, kr.getMatch(0).getEndPos());
+		assertEquals("... Bruckner (Wien) und Mathis Lussy (Paris). [{1:Inspiriert} " +
+				"{2:durch die}] additiven Modelle arabischer Rhythmik (er half ...", 
+				kr.getMatch(0).getSnippetBrackets());
+		
+		assertEquals(31, kr.getMatch(1).getStartPos());
+		assertEquals(34, kr.getMatch(1).getEndPos());
+		assertEquals("... des Sendens wird ein unhörbarer Unterton [{1:mitgesendet}, " +
+				"{2:auf den}] das angesprochene Funkgerät reagiert. Die Abkürzung ...", 
+				kr.getMatch(1).getSnippetBrackets());
+	}
+	
+	private String readFile(String path) {
+		StringBuilder sb = new StringBuilder();
+		try {
+		    BufferedReader in = new BufferedReader(new FileReader(path));
+		    String str;
+		    while ((str = in.readLine()) != null) {
+		    	sb.append(str);
+		    };
+		    in.close();
+		} catch (IOException e) {
+		    fail(e.getMessage());
+		}
+		return sb.toString();
+	}
+}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
index 6229ce1..8d0a05b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
@@ -67,7 +67,9 @@
 	assertEquals("StartPos (0)", 7, kr.match(0).startPos);
 	assertEquals("EndPos (0)", 9, kr.match(0).endPos);
 	assertEquals("SnippetBrackets (0)", "... bcabca[ba]c", kr.match(0).snippetBrackets());
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\">ba</span><span class=\"context-right\">c</span>", kr.match(0).snippetHTML());
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\"><span class=\"more\">" +
+			"</span>bcabca</span><span class=\"match\">ba</span><span class=\"context-right" +
+			"\">c</span>", kr.match(0).snippetHTML());
 
 	sq = new SpanTermQuery(new Term("base", "s:b"));
 	kr = ki.search(sq, (short) 10);
@@ -78,7 +80,9 @@
 	assertEquals("SnippetBrackets (0)", "a[b]cabcab ...", kr.match(0).snippetBrackets());
 
 
-	assertEquals("SnippetHTML (0)", "<span class=\"context-left\">a</span><span class=\"match\">b</span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", kr.match(0).snippetHTML());
+	assertEquals("SnippetHTML (0)", "<span class=\"context-left\">a</span><span class=\"match\">" +
+			"b</span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", 
+			kr.match(0).snippetHTML());
 
 	assertEquals("StartPos (1)", 4, kr.match(1).startPos);
 	assertEquals("EndPos (1)", 5, kr.match(1).endPos);
@@ -94,11 +98,14 @@
 	assertEquals("StartPos (0)", 1, kr.match(0).startPos);
 	assertEquals("EndPos (0)", 2, kr.match(0).endPos);
 	assertEquals("snippetBrackets (0)", "a[{b}]cabcab ...", kr.match(0).snippetBrackets());
-	assertEquals("snippetHTML (0)", "<span class=\"context-left\">a</span><span class=\"match\"><em class=\"class-0 level-0\">b</em></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>", kr.match(0).snippetHTML());
+	assertEquals("snippetHTML (0)", "<span class=\"context-left\">a</span><span class=\"match\">" +
+			"<em class=\"class-0 level-0\">b</em></span><span class=\"context-right\">cabcab<span " +
+			"class=\"more\"></span></span>", kr.match(0).snippetHTML());
 
 	assertEquals("StartPos (1)", 4, kr.match(1).startPos);
 	assertEquals("EndPos (1)", 5, kr.match(1).endPos);
 	assertEquals("snippetBrackets (1)", "abca[{b}]cabac", kr.match(1).snippetBrackets());
+	
 	assertEquals("StartPos (2)", 7, kr.match(2).startPos);
 	assertEquals("EndPos (2)", 8, kr.match(2).endPos);
 	assertEquals("snippetBrackets (2)", "... bcabca[{b}]ac", kr.match(2).snippetBrackets());
diff --git a/src/test/resources/queries/poly1.json b/src/test/resources/queries/poly1.json
new file mode 100644
index 0000000..bc1b138
--- /dev/null
+++ b/src/test/resources/queries/poly1.json
@@ -0,0 +1,82 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+   "announcements" : [
+      "Deprecated 2014-10-07: 'class' only to be supported until 3 months from deprecation date. Classes are now defined using the 'classOut' attribute.",
+      "Deprecated 2014-10-07: 'class' only to be supported until 3 months from deprecation date. Classes are now defined using the 'classOut' attribute."
+   ],
+   "collection" : {},
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "errors" : [],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+         {
+            "@type" : "korap:group",
+            "class" : 1,
+            "classOut" : 1,
+            "operands" : [
+               {
+                  "@type" : "korap:token",
+                  "wrap" : {
+                     "@type" : "korap:term",
+                     "foundry" : "tt",
+                     "key" : "VVPP",
+                     "layer" : "p",
+                     "match" : "match:eq"
+                  }
+               }
+            ],
+            "operation" : "operation:class"
+         },
+         {
+            "@type" : "korap:group",
+            "class" : 2,
+            "classOut" : 2,
+            "operands" : [
+               {
+                  "@type" : "korap:group",
+                  "operands" : [
+                     {
+                        "@type" : "korap:token",
+                        "wrap" : {
+                           "@type" : "korap:term",
+                           "foundry" : "tt",
+                           "key" : "APPR",
+                           "layer" : "pos",
+                           "match" : "match:eq"
+                        }
+                     },
+                     {
+                        "@type" : "korap:token",
+                        "wrap" : {
+                           "@type" : "korap:term",
+                           "foundry" : "mate",
+                           "key" : "case",
+                           "layer" : "m",
+                           "match" : "match:eq",
+                           "value" : "acc"
+                        }
+                     }
+                  ],
+                  "operation" : "operation:sequence"
+               }
+            ],
+            "operation" : "operation:class"
+         }
+      ],
+      "operation" : "operation:sequence"
+   },
+   "warnings" : []
+}
+  
+
diff --git a/src/test/resources/wiki/DDD-01402.json.gz b/src/test/resources/wiki/DDD-01402.json.gz
new file mode 100644
index 0000000..5a810ac
--- /dev/null
+++ b/src/test/resources/wiki/DDD-01402.json.gz
Binary files differ
diff --git a/src/test/resources/wiki/JJJ-00785.json.gz b/src/test/resources/wiki/JJJ-00785.json.gz
new file mode 100644
index 0000000..978027e
--- /dev/null
+++ b/src/test/resources/wiki/JJJ-00785.json.gz
Binary files differ