Added check for minimum repetition and formatted codes.

Change-Id: Id19e4d844ddb1cf46d69d68bacb5d07a656de5f3
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
index 7111b38..101290d 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
@@ -139,10 +139,9 @@
     @Test
     public void KorapClassQuery () throws QueryException {
         QueryBuilder kq = new QueryBuilder("field");
-        SpanQuery sq = kq
-                .seq(kq.seg("tree"),
-                        kq._(1, kq.contains(kq.tag("s"), kq.tag("np"))),
-                        kq.re("hey.*")).toQuery();
+        SpanQuery sq = kq.seq(kq.seg("tree"),
+                kq._(1, kq.contains(kq.tag("s"), kq.tag("np"))), kq.re("hey.*"))
+                .toQuery();
         assertEquals(
                 "spanNext(spanNext(field:tree, {1: spanContain(<field:s />, <field:np />)}), SpanMultiTermQueryWrapper(field:/hey.*/))",
                 sq.toString());
@@ -196,11 +195,8 @@
     @Test
     public void KorapShrinkQuery3 () throws QueryException {
         QueryBuilder kq = new QueryBuilder("field");
-        SpanQuery sq = kq
-                .focus(1,
-                        kq._(1,
-                                kq.seq(kq.tag("np"),
-                                        kq._(kq.seg("test").without("no")))))
+        SpanQuery sq = kq.focus(1, kq._(1,
+                kq.seq(kq.tag("np"), kq._(kq.seg("test").without("no")))))
                 .toQuery();
         assertEquals(
                 "focus(1: {1: spanNext(<field:np />, {1: spanNot(field:test, field:no, 0, 0)})})",
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
index d66be4f..af53472 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -22,13 +22,12 @@
 
     @Test
     public void queryJSONBsp1 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp1.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp1.jsonld").getFile());
 
         // There is a repetition in here
         // ([base=foo]|[base=bar])[base=foobar]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanOr([tokens:base:foo, spanRepetition(spanNext(tokens:base:foo, tokens:base:bar){1,100})])");
         assertTrue(sqwi.isOptional());
     };
@@ -36,13 +35,12 @@
 
     @Test
     public void queryJSONBsp1Disjunction () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp1c.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp1c.jsonld").getFile());
 
         // There is a repetition in here
         // ([base=foo]|[base=bar])[base=foobar]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanOr([tokens:base:foo, spanRepetition(spanNext(tokens:base:foo, tokens:base:bar){1,100})])");
         assertTrue(sqwi.isOptional());
     };
@@ -51,8 +49,8 @@
     @Test
     public void queryJSONBsp1b () throws QueryException {
 
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp1b.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp1b.jsonld").getFile());
 
         // [base=foo]|([base=foo][base=bar]) meta author=Goethe&year=1815
         assertEquals(sqwi.toQuery().toString(),
@@ -62,20 +60,19 @@
 
     @Test
     public void queryJSONBsp2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp2.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp2.jsonld").getFile());
 
         // ([base=foo]|[base=bar])[base=foobar]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanOr([tokens:mate/l:foo, tokens:mate/l:bar]), tokens:mate/l:foobar)");
     };
 
 
     @Test
     public void queryJSONBsp3 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp3.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp3.jsonld").getFile());
 
         // focus({[base=Mann]})
         assertEquals(sqwi.toQuery().toString(),
@@ -85,8 +82,8 @@
 
     @Test
     public void queryJSONBsp4 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp4.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp4.jsonld").getFile());
 
         // focus({[base=foo]}[orth=bar])
         assertEquals(sqwi.toQuery().toString(),
@@ -96,8 +93,8 @@
 
     @Test
     public void queryJSONBsp5 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp5.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp5.jsonld").getFile());
 
         // focus(1:[base=Der]{1:[base=Mann]}) 
         assertEquals(sqwi.toQuery().toString(),
@@ -107,8 +104,8 @@
 
     @Test
     public void queryJSONBsp6 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp6.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp6.jsonld").getFile());
 
         // [base=katze]
         assertEquals(sqwi.toQuery().toString(), "tokens:mate/l:Katze");
@@ -117,8 +114,8 @@
 
     @Test
     public void queryJSONBsp7 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp7.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp7.jsonld").getFile());
 
         // [!base=Katze]
         assertEquals("tokens:mate/l:Katze", sqwi.toQuery().toString());
@@ -128,8 +125,8 @@
 
     @Test
     public void queryJSONBsp9 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp9.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp9.jsonld").getFile());
 
         // [base=Katze&orth=Katzen]
         assertEquals(sqwi.toQuery().toString(),
@@ -139,8 +136,8 @@
 
     @Test
     public void queryJSONBsp9b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp9b.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp9b.jsonld").getFile());
 
         // [base=Katze&orth=Katzen]
         assertEquals(sqwi.toQuery().toString(),
@@ -150,8 +147,8 @@
 
     @Test
     public void queryJSONBsp10 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp10.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp10.jsonld").getFile());
 
         // [base=Katze][orth=und][orth=Hunde]
         assertEquals(sqwi.toQuery().toString(),
@@ -161,8 +158,8 @@
 
     @Test
     public void queryJSONBsp11 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp11.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp11.jsonld").getFile());
 
         // [base!=Katze | orth!=Katzen]
         /*
@@ -178,8 +175,8 @@
 
     @Test
     public void queryJSONBsp12 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp12.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp12.jsonld").getFile());
 
         // contains(<np>,[base=Mann])
         assertEquals(sqwi.toQuery().toString(),
@@ -189,8 +186,8 @@
 
     @Test
     public void queryJSONBsp13 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp13.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp13.jsonld").getFile());
 
         assertEquals(sqwi.toQuery().toString(),
                 "spanStartsWith(<tokens:np />, tokens:p:Det)");
@@ -199,8 +196,8 @@
 
     @Test
     public void queryJSONBsp13b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp13b.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp13b.jsonld").getFile());
 
         // startswith(<np>,[pos=Det])
         assertEquals(sqwi.toQuery().toString(),
@@ -210,8 +207,8 @@
 
     @Test
     public void queryJSONBsp14 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp14.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp14.jsonld").getFile());
 
         // 'vers{2,3}uch'
         assertEquals(sqwi.toQuery().toString(),
@@ -221,8 +218,8 @@
 
     @Test
     public void queryJSONBsp15 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp15.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp15.jsonld").getFile());
 
         // [orth='vers.*ch']
         assertEquals(sqwi.toQuery().toString(),
@@ -232,8 +229,8 @@
 
     @Test
     public void queryJSONBsp16 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp16.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp16.jsonld").getFile());
 
         // [(base=bar|base=foo)&orth=foobar]
         assertEquals(sqwi.toQuery().toString(),
@@ -243,8 +240,8 @@
 
     @Test
     public void queryJSONBsp17 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp17.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp17.jsonld").getFile());
 
         // within(<np>,[base=Mann])
         assertEquals(sqwi.toQuery().toString(),
@@ -254,8 +251,8 @@
 
     @Test
     public void queryJSONDemo () throws QueryException {
-        SpanQueryWrapper sqwi = new KrillQuery("tokens")
-                .fromKoral("{ \"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"foundry\" : \"base\", \"layer\" : \"p\", \"key\" : \"foo\", \"match\" : \"match:eq\" }}}");
+        SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral(
+                "{ \"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"foundry\" : \"base\", \"layer\" : \"p\", \"key\" : \"foo\", \"match\" : \"match:eq\" }}}");
 
         assertEquals(sqwi.toQuery().toString(), "tokens:base/p:foo");
     };
@@ -263,8 +260,8 @@
 
     @Test
     public void queryJSONBspClass () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp-class.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bsp-class.jsonld").getFile());
 
         // within(<np>,[base=Mann])
         assertEquals(sqwi.toQuery().toString(),
@@ -274,8 +271,8 @@
 
     @Test
     public void queryJSONcosmas3 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas3.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas3.json").getFile());
 
         // "das /+w1:3 Buch"
         assertEquals(sqwi.toQuery().toString(),
@@ -285,56 +282,52 @@
 
     @Test
     public void queryJSONcosmas4 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas4.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas4.json").getFile());
 
         // "das /+w1:3,s1:1 Buch"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanMultipleDistance(tokens:s:das, tokens:s:Buch, [(w[1:3], ordered, notExcluded), (base/s:s[1:1], ordered, notExcluded)])");
     };
 
 
     @Test
     public void queryJSONcosmas4b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas4b.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas4b.json").getFile());
 
         // "das /+w1:3,s1 Buch"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanMultipleDistance(tokens:s:das, tokens:s:Buch, [(w[1:3], ordered, notExcluded), (base/s:s[0:1], ordered, notExcluded)])");
     };
 
 
     @Test
     public void queryJSONcosmas10 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas10.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas10.json").getFile());
 
         // "Institut für $deutsche Sprache"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanNext(spanNext(tokens:s:Institut, tokens:s:für), tokens:i:deutsche), tokens:s:Sprache)");
     };
 
 
     @Test
     public void queryJSONcosmas10b () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas10b.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas10b.json").getFile());
 
         // "Institut $FÜR $deutsche Sprache"
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanNext(spanNext(tokens:s:Institut, tokens:i:für), tokens:i:deutsche), tokens:s:Sprache)");
     };
 
 
     @Test
     public void queryJSONcosmas16 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas16.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas16.json").getFile());
 
         // "$wegen #IN(L) <s>"
         assertEquals(sqwi.toQuery().toString(),
@@ -344,8 +337,8 @@
 
     @Test
     public void queryJSONcosmas17 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas17.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas17.json").getFile());
 
         // "#BED($wegen , +sa)"
         assertEquals(sqwi.toQuery().toString(),
@@ -355,8 +348,8 @@
 
     @Test
     public void queryJSONcosmas20 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/cosmas20.json").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/cosmas20.json").getFile());
 
         //     "MORPH(V) #IN(R) #ELEM(S)"
         assertEquals(sqwi.toQuery().toString(),
@@ -366,20 +359,19 @@
 
     @Test
     public void queryJSONrepetition () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp-repetition.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bsp-repetition.jsonld").getFile());
 
         // der[cnx/p=A]{0,2}[tt/p=NN]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(tokens:s:der, spanOr([tokens:tt/p:NN, spanNext(spanRepetition(tokens:cnx/p:A{1,2}), tokens:tt/p:NN)]))");
     };
 
 
     @Test
     public void queryJSONboundaryBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bsp-boundary.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bsp-boundary.jsonld").getFile());
 
         // Tal []{1,} Wald
         assertEquals(sqwi.toQuery().toString(),
@@ -389,20 +381,20 @@
 
     @Test
     public void queryJSONcosmasBoundaryBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/cosmas_boundary.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/cosmas_boundary.jsonld").getFile());
 
         // Namen /s1 Leben
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(129: spanElementDistance({129: tokens:s:Namen}, {129: tokens:s:Leben}, [(base/s:s[0:1], notOrdered, notExcluded)]))");
     };
 
 
     @Test
     public void queryJSONfoundryForOrthBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/foundry_for_orth.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/bugs/foundry_for_orth.jsonld")
+                        .getFile());
 
         // opennlp/orth:Baum
         assertEquals(sqwi.toQuery().toString(), "tokens:s:Baum");
@@ -411,8 +403,9 @@
 
     @Test
     public void queryJSONfoundryForOrthBug2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/foundry_for_orth_2.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/foundry_for_orth_2.jsonld")
+                .getFile());
 
         // baum/i
         assertEquals(sqwi.toQuery().toString(), "tokens:i:baum");
@@ -423,8 +416,9 @@
     public void queryJSONunderspecifiedTokenBug () {
         // ((MORPH(APPR) ODER MORPH(APPRART)) /+w1 Urlaub
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/underspecified_token.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/bugs/underspecified_token.jsonld")
+                    .getFile());
             new KrillQuery("tokens").fromKoral(json);
         }
         catch (QueryException e) {
@@ -435,10 +429,9 @@
 
     @Test
     public void queryJSONspecialLayerBug () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/special_layer.jsonld").getFile());
-        assertEquals(
-                sqwi.toQuery().toString(),
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/special_layer.jsonld").getFile());
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(spanNext(spanNext(tokens:s:Baum, tokens:cnx/p:CC), tokens:tt/l:Baum), <tokens:xip/c:MC />)");
     };
 
@@ -446,11 +439,11 @@
     @Test
     public void queryJSONrepetitionGroupRewriteBug () throws QueryException {
         // ([cnx/p="A"][]){2}
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/repetition_group_rewrite.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/repetition_group_rewrite.jsonld")
+                .getFile());
 
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanRepetition(spanExpansion(SpanMultiTermQueryWrapper(tokens:/cnx/p:A/), []{1, 1}, right){2,2})");
     };
 
@@ -458,11 +451,11 @@
     @Test
     public void queryJSONoverlapsFrameWorkaround () throws QueryException {
         // overlaps(<s>,[tt/p=CARD][tt/p="N.*"])
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/overlaps_frame_workaround.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/overlaps_frame_workaround.jsonld")
+                .getFile());
 
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanOverlap(<tokens:s />, spanNext(tokens:tt/p:CARD, SpanMultiTermQueryWrapper(tokens:/tt/p:N.*/)))");
     };
 
@@ -470,8 +463,9 @@
     @Test
     public void queryJSONflags1 () throws QueryException {
         // buchstabe/i
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/flags/caseInsensitive.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(
+                getClass().getResource("/queries/flags/caseInsensitive.jsonld")
+                        .getFile());
 
         assertEquals(sqwi.toQuery().toString(), "tokens:i:buchstabe");
     };
@@ -480,11 +474,11 @@
     @Test
     public void queryJSONspanWrapDeserializationBug () throws QueryException {
         // contains(<s>, Erde  []* Sonne)
-        SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
-                "/queries/bugs/unspecified_key_bug.jsonld").getFile());
+        SpanQueryWrapper sqwi = jsonQuery(getClass()
+                .getResource("/queries/bugs/unspecified_key_bug.jsonld")
+                .getFile());
 
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanContain(<tokens:s />, spanDistance(tokens:s:Erde, tokens:s:Sonne, [(w[1:101], ordered, notExcluded)]))");
     };
 
@@ -493,22 +487,22 @@
     public void queryJSONflags2 () throws QueryException {
         // buchstabe/i
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/flags/unknown1.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/flags/unknown1.jsonld").getFile());
             KrillQuery kq = new KrillQuery("tokens");
             assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "tokens:s:buchstabe");
             assertEquals(kq.getWarning(0).getCode(), 748);
 
-            json = getString(getClass().getResource(
-                    "/queries/flags/unknown2.jsonld").getFile());
+            json = getString(getClass()
+                    .getResource("/queries/flags/unknown2.jsonld").getFile());
             kq = new KrillQuery("tokens");
             assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "tokens:i:buchstabe");
             assertEquals(kq.getWarning(0).getCode(), 748);
 
-            json = getString(getClass().getResource(
-                    "/queries/flags/unknown3.jsonld").getFile());
+            json = getString(getClass()
+                    .getResource("/queries/flags/unknown3.jsonld").getFile());
             kq = new KrillQuery("tokens");
             assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "tokens:i:buchstabe");
@@ -525,8 +519,9 @@
     public void queryJSONelement () throws QueryException {
         // <base/s=s>
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/element/simple-element.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/element/simple-element.jsonld")
+                    .getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
             assertEquals(kq.fromKoral(json).toQuery().toString(),
@@ -542,12 +537,12 @@
     public void queryJSONinfiniteExpansion () throws QueryException {
         // der []*
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/expansion_bug_3.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/bugs/expansion_bug_3.jsonld")
+                    .getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
-            assertEquals(
-                    kq.fromKoral(json).toQuery().toString(),
+            assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:c, []{0, 4}, right)}))");
         }
         catch (QueryException e) {
@@ -560,8 +555,8 @@
     public void queryJSONcomplexSpanOrTerm () throws QueryException {
         // startsWith(<base/s=s>, { lassen | laufen })
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/span_or_bug.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource("/queries/bugs/span_or_bug.jsonld").getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
             assertEquals(kq.fromKoral(json).toQuery().toString(),
@@ -577,12 +572,13 @@
     public void queryJSONdistancesWithRegexes () throws QueryException {
         // "der" []{2,3} [opennlp/p="NN"]
         try {
-            String json = getString(getClass().getResource(
-                    "/queries/bugs/distances_with_regex_bug.jsonld").getFile());
+            String json = getString(getClass()
+                    .getResource(
+                            "/queries/bugs/distances_with_regex_bug.jsonld")
+                    .getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
-            assertEquals(
-                    kq.fromKoral(json).toQuery().toString(),
+            assertEquals(kq.fromKoral(json).toQuery().toString(),
                     "spanDistance(SpanMultiTermQueryWrapper(tokens:/s:der/), SpanMultiTermQueryWrapper(tokens:/opennlp/p:NN/), [(w[3:4], ordered, notExcluded)])");
         }
         catch (QueryException e) {
@@ -590,35 +586,38 @@
         };
     };
 
-	@Test
+
+    @Test
     public void queryJSONregexRewrite1 () throws QueryException {
         // "der" [.+?]
-		String json = getString(getClass().getResource(
-									"/queries/sequence/regex-rewrite-1.jsonld").getFile());
-		KrillQuery kq = new KrillQuery("tokens");
+        String json = getString(getClass()
+                .getResource("/queries/sequence/regex-rewrite-1.jsonld")
+                .getFile());
+        KrillQuery kq = new KrillQuery("tokens");
 
-		assertEquals(
-			kq.fromKoral(json).toQuery().toString(),
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
+        assertEquals(kq.fromKoral(json).toQuery().toString(),
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
     };
 
-	@Test
+
+    @Test
     public void queryJSONregexRewrite2 () throws QueryException {
         // "der" [.*] [.*?] [.+] [.+?]
-		String json = getString(getClass().getResource(
-									"/queries/sequence/regex-rewrite-2.jsonld").getFile());
-		KrillQuery kq = new KrillQuery("tokens");
+        String json = getString(getClass()
+                .getResource("/queries/sequence/regex-rewrite-2.jsonld")
+                .getFile());
+        KrillQuery kq = new KrillQuery("tokens");
 
-		assertEquals(
-			kq.fromKoral(json).toQuery().toString(),
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{4, 4}, right)}))");
+        assertEquals(kq.fromKoral(json).toQuery().toString(),
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{4, 4}, right)}))");
     };
 
 
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {
-            BufferedReader in = new BufferedReader(new FileReader(URLDecoder.decode(path,"UTF-8")));
+            BufferedReader in = new BufferedReader(
+                    new FileReader(URLDecoder.decode(path, "UTF-8")));
             String str;
             while ((str = in.readLine()) != null) {
                 contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java
index 70b559e..b259fb8 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanAlterQuery.java
@@ -29,8 +29,8 @@
 
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c");
-        assertEquals("spanOr([field:b, field:c])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c])",
+                ssaquery.toQuery().toString());
     };
 
 
@@ -38,8 +38,8 @@
     public void spanAlterQuery3 () throws QueryException {
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c").or("d");
-        assertEquals("spanOr([field:b, field:c, field:d])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c, field:d])",
+                ssaquery.toQuery().toString());
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
index b9ef7c4..844b8ec 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
@@ -16,8 +16,10 @@
     @Test
     public void testFirstOperandRef () throws IOException, QueryException {
 
-        String filepath = getClass().getResource(
-                "/queries/reference/first-operand-reference.jsonld").getFile();
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/first-operand-reference.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -36,8 +38,10 @@
     @Test
     public void testSecondOperandRef () throws QueryException {
 
-        String filepath = getClass().getResource(
-                "/queries/reference/second-operand-reference.jsonld").getFile();
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/second-operand-reference.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -47,14 +51,16 @@
                 "spanReference(spanNext(focus(2: focus(#[1,2]spanSegment({3: tokens:p:P}, "
                         + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
                         + "focus(1: spanNext({2: tokens:p:V}, {1: <tokens:c:NP />}))))))), "
-                        + "{3: tokens:p:P}), 3)", sq.toString());
+                        + "{3: tokens:p:P}), 3)",
+                sq.toString());
     }
 
 
     @Test
     public void testMultipleReferences () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/reference/multiple-references.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/reference/multiple-references.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -74,8 +80,9 @@
 
         // ND: I don't understand what this query should be about ...
         // EM: There was just a bug with multiple distance
-        String filepath = getClass().getResource(
-                "/queries/reference/bug-multiple-distance-simple.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/reference/bug-multiple-distance-simple.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -85,8 +92,9 @@
                 sq.toString());
 
         // "/queries/reference/distance-reference.jsonld").getFile();
-        filepath = getClass().getResource(
-                "/queries/reference/bug-multiple-distance.jsonld").getFile();
+        filepath = getClass()
+                .getResource("/queries/reference/bug-multiple-distance.jsonld")
+                .getFile();
         sqwi = getJSONQuery(filepath);
         sq = sqwi.toQuery();
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
index caaef7b..8be9a79 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
@@ -14,8 +14,9 @@
     @Test
     public void testMatchAnyRelationSourceWithAttribute ()
             throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/any-source-with-attribute.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/any-source-with-attribute.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
@@ -30,18 +31,20 @@
     @Test
     public void testMatchAnyRelationTargetWithAttribute ()
             throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/any-target-with-attribute.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/any-target-with-attribute.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
-        // "focus(#[1,2]spanSegment(focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
-        // +
-        // "<tokens:c:vp />)), spanWithAttribute(spanAttribute(tokens:type:case:accusative))))",
-        //
+                // "focus(#[1,2]spanSegment(focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
+                // +
+                // "<tokens:c:vp />)), spanWithAttribute(spanAttribute(tokens:type:case:accusative))))",
+                //
                 "focus(#[1,2]spanSegment(spanWithAttribute(spanAttribute(tokens:type:case:accusative)), "
                         + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
-                        + "<tokens:c:vp />))))", sq.toString());
+                        + "<tokens:c:vp />))))",
+                sq.toString());
 
         // System.out.println(sq.toString());
     }
@@ -50,24 +53,28 @@
     @Test
     public void testMatchSpecificRelationSourceWithAttribute ()
             throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/specific-source-with-attribute.json")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/relation/specific-source-with-attribute.json")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
 
-        assertEquals("focus(#[1,2]spanSegment(<tokens:c:vp />, "
-                + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
-                + "spanElementWithAttribute(<tokens:c:np />, "
-                + "spanAttribute(tokens:type:case:accusative))))))",
+        assertEquals(
+                "focus(#[1,2]spanSegment(<tokens:c:vp />, "
+                        + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
+                        + "spanElementWithAttribute(<tokens:c:np />, "
+                        + "spanAttribute(tokens:type:case:accusative))))))",
                 sq.toString());
     }
 
 
     @Test
-    public void testMatchBothRelationNodeWithAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/both-operands-with-attribute.json")
+    public void testMatchBothRelationNodeWithAttribute ()
+            throws QueryException {
+        String filepath = getClass()
+                .getResource(
+                        "/queries/relation/both-operands-with-attribute.json")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -84,8 +91,8 @@
     @Test
     public void testMatchRelationSource () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/match-source.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/match-source.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -97,8 +104,8 @@
     @Test
     public void testMatchRelationTarget () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/match-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/match-target.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -110,8 +117,9 @@
     @Test
     public void testMatchRelationSourceAndTarget () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/match-source-and-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/match-source-and-target.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -124,8 +132,9 @@
     @Test
     public void testMatchOperandWithProperty () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/operand-with-property.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/operand-with-property.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -138,8 +147,9 @@
     @Test
     public void testMatchOperandWithAttribute () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/operand-with-attribute.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/operand-with-attribute.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -152,8 +162,8 @@
     @Test
     public void testMatchRelationOnly () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/relation-only.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/relation-only.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("focus(#[1,2]spanRelation(tokens:>:mate/d:HEAD))",
@@ -164,8 +174,8 @@
     @Test
     public void testFocusSource () throws QueryException {
         //
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-source.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-source.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -176,8 +186,8 @@
 
     @Test
     public void testFocusTarget () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-target.json").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -189,8 +199,9 @@
 
     @Test
     public void testFocusEmptyTarget () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-empty-target.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-empty-target.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -201,8 +212,9 @@
 
     @Test
     public void testFocusEmptyBoth () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/relation/focus-empty-both.json").getFile();
+        String filepath = getClass()
+                .getResource("/queries/relation/focus-empty-both.json")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java
index 9791fa4..f509acb 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentAlterQuery.java
@@ -29,8 +29,8 @@
 
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c");
-        assertEquals("spanOr([field:b, field:c])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c])",
+                ssaquery.toQuery().toString());
     };
 
 
@@ -38,8 +38,8 @@
     public void spanAlterQuery3 () throws QueryException {
         SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
         ssaquery.or("b").or("c").or("d");
-        assertEquals("spanOr([field:b, field:c, field:d])", ssaquery.toQuery()
-                .toString());
+        assertEquals("spanOr([field:b, field:c, field:d])",
+                ssaquery.toQuery().toString());
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java
index 8c857a2..791af7c 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentQuery.java
@@ -23,8 +23,8 @@
         assertEquals("field:a", ssquery.toQuery().toString());
 
         ssquery = new SpanSegmentQueryWrapper("field", "a", "b");
-        assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery()
-                .toString());
+        assertEquals("spanSegment(field:a, field:b)",
+                ssquery.toQuery().toString());
 
         ssquery = new SpanSegmentQueryWrapper("field", "a", "b", "c");
         assertEquals("spanSegment(spanSegment(field:a, field:b), field:c)",
@@ -40,8 +40,8 @@
         assertEquals("field:a", ssquery.toQuery().toString());
 
         ssquery = new SpanSegmentQueryWrapper("field", "a", "b");
-        assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery()
-                .toString());
+        assertEquals("spanSegment(field:a, field:b)",
+                ssquery.toQuery().toString());
 
         ssquery.without("c");
         assertEquals("spanNot(spanSegment(field:a, field:b), field:c, 0, 0)",
@@ -114,18 +114,18 @@
     public void spanSegmentCloneQuery () throws QueryException {
         SpanSegmentQueryWrapper ssquery = new SpanSegmentQueryWrapper("field",
                 "a", "b");
-        assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery()
-                .toString());
+        assertEquals("spanSegment(field:a, field:b)",
+                ssquery.toQuery().toString());
 
         SpanSegmentQueryWrapper ssquery2 = new SpanSegmentQueryWrapper("field",
                 ssquery);
-        assertEquals(ssquery.toQuery().toString(), ssquery2.toQuery()
-                .toString());
+        assertEquals(ssquery.toQuery().toString(),
+                ssquery2.toQuery().toString());
 
         SpanSegmentQueryWrapper ssquery3 = ssquery2.clone();
-        assertEquals(ssquery.toQuery().toString(), ssquery3.toQuery()
-                .toString());
-        assertEquals(ssquery2.toQuery().toString(), ssquery3.toQuery()
-                .toString());
+        assertEquals(ssquery.toQuery().toString(),
+                ssquery3.toQuery().toString());
+        assertEquals(ssquery2.toQuery().toString(),
+                ssquery3.toQuery().toString());
     };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java
index 94b3437..5230ed0 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSegmentSequenceQuery.java
@@ -29,15 +29,15 @@
 
         sssq.append("c");
 
-        assertEquals("spanNext(spanNext(field:a, field:b), field:c)", sssq
-                .toQuery().toString());
+        assertEquals("spanNext(spanNext(field:a, field:b), field:c)",
+                sssq.toQuery().toString());
     };
 
 
     @Test
     public void spanSegmentSequenceQuery2 () throws QueryException {
-        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field",
-                "-c", "-d", "-e");
+        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field", "-c",
+                "-d", "-e");
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "a", "b");
 
@@ -54,7 +54,8 @@
     public void spanSegmentSequenceQuery3 () throws QueryException {
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "a", "b");
-        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field", "c.?d");
+        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field",
+                "c.?d");
 
         sssq.append(ssreq);
 
@@ -71,8 +72,8 @@
 
         sssq.prepend("a");
 
-        assertEquals("spanNext(spanNext(field:a, field:b), field:c)", sssq
-                .toQuery().toString());
+        assertEquals("spanNext(spanNext(field:a, field:b), field:c)",
+                sssq.toQuery().toString());
     };
 
 
@@ -80,8 +81,8 @@
     public void spanSegmentSequenceQueryPrepend2 () throws QueryException {
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "d", "e");
-        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field",
-                "-a", "-b", "-c");
+        SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field", "-a",
+                "-b", "-c");
 
         sssq.prepend(ssq);
 
@@ -95,7 +96,8 @@
     public void spanSegmentSequenceQueryPrepend3 () throws QueryException {
         SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field",
                 "c", "d");
-        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field", "a.?b");
+        SpanRegexQueryWrapper ssreq = new SpanRegexQueryWrapper("field",
+                "a.?b");
 
         sssq.prepend(ssreq);
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
index 1c6deaf..912642a 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
@@ -32,8 +32,8 @@
         assertFalse(sssq.hasConstraints());
 
         sssq.append("c");
-        assertEquals("spanNext(spanNext(field:a, field:b), field:c)", sssq
-                .toQuery().toString());
+        assertEquals("spanNext(spanNext(field:a, field:b), field:c)",
+                sssq.toQuery().toString());
         assertFalse(sssq.hasConstraints());
 
         sssq = new SpanSequenceQueryWrapper("field");
@@ -74,14 +74,14 @@
 
         // Synopsis 1
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum");
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         // Synopsis 2
         ssqw = new SpanSequenceQueryWrapper("tokens");
         ssqw.append("der").append("Baum");
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         // Append a sequence
         ssqw = new SpanSequenceQueryWrapper("tokens");
@@ -97,8 +97,8 @@
         // Synopsis 3
         ssqw = new SpanSequenceQueryWrapper("tokens", "Baum");
         ssqw.prepend("der");
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         // Prepend a sequence
         ssqw = new SpanSequenceQueryWrapper("tokens");
@@ -115,16 +115,17 @@
         // Add constraint
         ssqw.withConstraint(2, 4);
         // This may change
-        assertEquals("spanDistance(spanDistance(spanDistance(tokens:der, "
-                + "tokens:Baum, [(w[2:4], ordered, notExcluded)]), "
-                + "tokens:fiel, [(w[2:4], ordered, notExcluded)]), "
-                + "tokens:still, [(w[2:4], ordered, notExcluded)])", ssqw
-                .toQuery().toString());
+        assertEquals(
+                "spanDistance(spanDistance(spanDistance(tokens:der, "
+                        + "tokens:Baum, [(w[2:4], ordered, notExcluded)]), "
+                        + "tokens:fiel, [(w[2:4], ordered, notExcluded)]), "
+                        + "tokens:still, [(w[2:4], ordered, notExcluded)])",
+                ssqw.toQuery().toString());
 
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum")
                 .withConstraint(1, 1);
-        assertEquals("spanNext(tokens:der, tokens:Baum)", ssqw.toQuery()
-                .toString());
+        assertEquals("spanNext(tokens:der, tokens:Baum)",
+                ssqw.toQuery().toString());
 
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum")
                 .withConstraint(1, 2, "s");
@@ -134,16 +135,20 @@
 
         ssqw = new SpanSequenceQueryWrapper("tokens", "der", "Baum")
                 .withConstraint(1, 2, "s").withConstraint(2, 3, "x");
-        assertEquals("spanMultipleDistance(tokens:der, tokens:Baum, "
-                + "[(s[1:2], ordered, notExcluded), "
-                + "(x[2:3], ordered, notExcluded)])", ssqw.toQuery().toString());
+        assertEquals(
+                "spanMultipleDistance(tokens:der, tokens:Baum, "
+                        + "[(s[1:2], ordered, notExcluded), "
+                        + "(x[2:3], ordered, notExcluded)])",
+                ssqw.toQuery().toString());
 
         ssqw = new SpanSequenceQueryWrapper("tokens").append("Baum")
                 .prepend("der").withConstraint(1, 2, "s", true)
                 .withConstraint(2, 3, "x");
-        assertEquals("spanMultipleDistance(tokens:der, "
-                + "tokens:Baum, [(s[1:2], ordered, excluded), "
-                + "(x[2:3], ordered, notExcluded)])", ssqw.toQuery().toString());
+        assertEquals(
+                "spanMultipleDistance(tokens:der, "
+                        + "tokens:Baum, [(s[1:2], ordered, excluded), "
+                        + "(x[2:3], ordered, notExcluded)])",
+                ssqw.toQuery().toString());
 
 
         // Support empty class ins sequence 
@@ -151,8 +156,8 @@
         srqw = new SpanRepetitionQueryWrapper();
         scqw = new SpanClassQueryWrapper(srqw, (short) 3);
         ssqw.append(scqw);
-        assertEquals("spanExpansion(field:Der, []{1, 1}, right, class:3)", ssqw
-                .toQuery().toString());
+        assertEquals("spanExpansion(field:Der, []{1, 1}, right, class:3)",
+                ssqw.toQuery().toString());
 
         // Support empty class ins sequence 
         ssqw = new SpanSequenceQueryWrapper("field");
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 aff5cf8..6501d77 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -37,8 +37,7 @@
     @Test
     public void queryJSONseqEmptyEnd () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-last.jsonld");
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
     };
 
@@ -47,8 +46,7 @@
     public void queryJSONseqEmptyEndClass () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-last-class.jsonld");
         // der{3:[]}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right, class:3)}))");
     };
 
@@ -57,8 +55,7 @@
     public void queryJSONseqEmptyEndRepetition () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-last-repetition.jsonld");
         // der[]{3,5}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{3, 5}, right)}))");
     };
 
@@ -92,7 +89,8 @@
 
     @Test
     public void queryJSONseqEmptyStartRepetition2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-first-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-first-repetition-2.jsonld");
         // []{0,0}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(), "tokens:tt/p:NN");
     };
@@ -111,8 +109,7 @@
     public void queryJSONseqEmptyMiddleClass () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-middle-class.jsonld");
         // der{1:[]}[tt/p=NN]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "spanNext(tokens:s:der, spanExpansion(tokens:tt/p:NN, []{1, 1}, left, class:1))");
     };
 
@@ -130,8 +127,7 @@
     public void queryJSONseqEmptySurround () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-surround.jsonld");
         // [][tt/p=NN][]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{1, 1}, right)}))");
     };
 
@@ -140,8 +136,7 @@
     public void queryJSONseqEmptySurroundClass () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-class.jsonld");
         // [][tt/p=NN]{2:[]}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{1, 1}, right, class:2)}))");
     };
 
@@ -150,28 +145,27 @@
     public void queryJSONseqEmptySurroundClass2 () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-class-2.jsonld");
         // {3:[]}[tt/p=NN]{2:[]}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left, class:3), []{1, 1}, right, class:2)}))");
     };
 
 
     @Test
     public void queryJSONseqEmptySurroundRepetition () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-surround-repetition.jsonld");
         // [][tt/p=NN][]{2,7}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{2, 7}, right)}))");
     };
 
 
     @Test
     public void queryJSONseqEmptySurroundRepetition2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-surround-repetition-2.jsonld");
         // []{3,5}[tt/p=NN][]{2,7}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{3, 5}, left), []{2, 7}, right)}))");
     };
 
@@ -179,12 +173,12 @@
     @Test
     public void queryJSONseqEmptySurroundRepetitionClass ()
             throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition-class.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-surround-repetition-class.jsonld");
         // {1:[]}{3,8}[tt/p=NN]{2:[]{2,7}}
         // Ist gleichbedeutend mit
         // {1:[]{3,8}}[tt/p=NN]{2:[]}{2,7}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{3, 8}, left, class:1), []{2, 7}, right, class:2)}))");
     };
 
@@ -210,15 +204,15 @@
     public void queryJSONseqNegativeEnd () throws QueryException {
         SpanQueryWrapper sqwi = jsonQueryFile("negative-last.jsonld");
         // [tt/p=NN][tt/p!=NN]
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right)}))");
     };
 
 
     @Test
     public void queryJSONseqNegativeStartRepetition () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-first-repetition.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-first-repetition.jsonld");
         // [tt/p!=NN]{4,5}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(),
                 "spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, left)");
@@ -227,7 +221,8 @@
 
     @Test
     public void queryJSONseqNegativeStartRepetition2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-first-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-first-repetition-2.jsonld");
         // [tt/p!=NN]{0,5}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(),
                 "spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{0, 5}, left)");
@@ -236,7 +231,8 @@
 
     @Test
     public void queryJSONseqNegativeStartRepetition3 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-first-repetition-3.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-first-repetition-3.jsonld");
         // [tt/p!=NN]{0,0}[tt/p=NN]
         assertEquals(sqwi.toQuery().toString(), "tokens:tt/p:NN");
     };
@@ -247,18 +243,18 @@
         SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class.jsonld");
         // [tt/p=NN]{2:[tt/p!=NN]}
         SpanQuery sq = sqwi.toQuery();
-        assertEquals(
-                sq.toString(),
+        assertEquals(sq.toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right, class:2)}))");
     };
 
 
     @Test
-    public void queryJSONseqNegativeEndRepetitionClass () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class-repetition.jsonld");
+    public void queryJSONseqNegativeEndRepetitionClass ()
+            throws QueryException {
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-class-repetition.jsonld");
         // [tt/p=NN]{2:[tt/p!=NN]{4,5}}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, right, class:2)}))");
     };
 
@@ -266,17 +262,18 @@
     @Test
     public void queryJSONseqNegativeEndRepetitionClass2 ()
             throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class-repetition-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-class-repetition-2.jsonld");
         // [tt/p=NN]{2:[tt/p!=NN]}{4,5}
-        assertEquals(
-                sqwi.toQuery().toString(),
+        assertEquals(sqwi.toQuery().toString(),
                 "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, right, class:2)}))");
     };
 
 
     @Test
     public void queryJSONseqNegativelastConstraint () {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-constraint.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-constraint.jsonld");
         try {
             sqwi.toQuery().toString();
             fail("Should throw an exception");
@@ -301,7 +298,8 @@
 
     @Test
     public void queryJSONseqNegativeEndSequence2 () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("negative-last-sequence-2.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "negative-last-sequence-2.jsonld");
         // [tt/p!=NN]([tt/p!=DET][tt/p=NN])
 
         // spanNext(tokens:tt/p:NN, 
@@ -334,7 +332,8 @@
 
     @Test
     public void queryJSONseqSentenceDistanceExcluded () throws QueryException {
-        SpanQueryWrapper sqwi = jsonQueryFile("distance-sentence-excluded.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "distance-sentence-excluded.jsonld");
 
         assertEquals(
                 "spanElementDistance({129: tokens:s:der}, {129: tokens:s:Baum}, [(base/s:s[0:0], notOrdered, excluded)])",
@@ -356,7 +355,8 @@
     public void queryJSONkoralOptionalityInDistanceBug () {
         try {
             // Sonne [] Mond?
-            SpanQueryWrapper sqwi = jsonQueryFile("distance-with-optionality.jsonld");
+            SpanQueryWrapper sqwi = jsonQueryFile(
+                    "distance-with-optionality.jsonld");
             sqwi.toQuery().toString();
         }
         catch (QueryException qe) {
@@ -369,12 +369,14 @@
 
 
     @Test
-    public void queryJSONkoralOptionalityAfterEmptyBug () throws QueryException {
+    public void queryJSONkoralOptionalityAfterEmptyBug ()
+            throws QueryException {
         // Sonne [] Mond?
-        SpanQueryWrapper sqwi = jsonQueryFile("empty-followed-by-optionality.jsonld");
+        SpanQueryWrapper sqwi = jsonQueryFile(
+                "empty-followed-by-optionality.jsonld");
         assertEquals(
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
-			sqwi.toQuery().toString());
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
+                sqwi.toQuery().toString());
         // Could also be a distance at the end ... that's a query planner thing.
     };
 
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
index 2713702..a1b386d 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
@@ -17,8 +17,8 @@
     @Test
     public void testTermQuery () throws QueryException {
         // subspan(tokens:tt/l:Haus, 0, 1)
-        String filepath = getClass().getResource(
-                "/queries/submatch/termquery.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/termquery.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:tt/l:Haus", sq.toString());
@@ -28,8 +28,9 @@
     @Test
     public void testTermStartOffset () throws QueryException {
         // subspan(tokens:tt/l:Haus, -1, 0)
-        String filepath = getClass().getResource(
-                "/queries/submatch/term-start-offset.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/term-start-offset.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:tt/l:Haus", sq.toString());
@@ -39,8 +40,8 @@
     @Test
     public void testTermNull () throws QueryException {
         // subspan(tokens:tt/l:Haus, 1, 1)
-        String filepath = getClass().getResource(
-                "/queries/submatch/term-null.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/term-null.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(null, sq);
@@ -50,8 +51,9 @@
     @Test
     public void testElementQuery () throws QueryException {
         // submatch(1,4:<s>)
-        String filepath = getClass().getResource(
-                "/queries/submatch/simpleElement.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/simpleElement.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -63,8 +65,8 @@
     @Test
     public void testNoLength () throws QueryException {
         // submatch(1,:<s>)
-        String filepath = getClass().getResource(
-                "/queries/submatch/noLength.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/noLength.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("subspan(<tokens:s />, 1, 0)", sq.toString());
@@ -74,8 +76,8 @@
     @Test
     public void testMinusStartOffset () throws QueryException {
         // submatch(-1,4:<s>)
-        String filepath = getClass().getResource(
-                "/queries/submatch/minusStart.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/minusStart.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("subspan(<tokens:s />, -1, 4)", sq.toString());
@@ -86,8 +88,9 @@
     public void testEmptyMinusStartOffset () throws QueryException {
         // no optimization
         // submatch(-1,4:der []{1,8})
-        String filepath = getClass().getResource(
-                "/queries/submatch/empty-minusStart.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/empty-minusStart.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -100,8 +103,8 @@
     public void testEmptyMax () throws QueryException {
         // no optimization
         // submatch(1,2:der []{1,8})
-        String filepath = getClass().getResource(
-                "/queries/submatch/empty-max.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/empty-max.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -112,8 +115,8 @@
 
     @Test
     public void testCaseEmptyWrapped () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/submatch/wrapped.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/wrapped.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -126,12 +129,14 @@
     @Test
     public void testCaseEmptyEmbedded () throws QueryException {
         // die subspan(der []{1,}, 2,3)
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
-        assertEquals("spanNext({1: tokens:s:die}, {1: subspan(spanExpansion("
-                + "tokens:s:der, []{1, 100}, right), 2, 3)})", sq.toString());
+        assertEquals(
+                "spanNext({1: tokens:s:die}, {1: subspan(spanExpansion("
+                        + "tokens:s:der, []{1, 100}, right), 2, 3)})",
+                sq.toString());
     }
 
 
@@ -139,8 +144,9 @@
     public void testCaseEmptyEmbeddedNull () throws QueryException {
         // die subspan([],5,6)
         // start offset is bigger than the original span
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-null.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded-null.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:s:die", sq.toString());
@@ -150,8 +156,9 @@
     @Test
     public void testCaseEmptyEmbeddedValid () throws QueryException {
         // die subspan([]{0,5},2)
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-valid-empty.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded-valid-empty.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -163,8 +170,9 @@
     @Test
     public void testNegativeToken () throws QueryException {
         // submatch(0,1:[base != Baum])
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-token.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-token.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals("tokens:l:Baum", sq.toString());
@@ -174,8 +182,8 @@
     @Test
     public void testNegativeSequence () throws QueryException {
         // das submatch(0,1:[base != Baum])
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-seq.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-seq.jsonld").getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -187,8 +195,9 @@
     @Test
     public void testNegativeSequenceWithClass () throws QueryException {
         // das {1:submatch(0,1:[base != Baum])}
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-sequence-class.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-sequence-class.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -200,8 +209,9 @@
     @Test
     public void testNegativeEmbeddedSequence () throws QueryException {
         // submatch(1,1:das [base != Baum])
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-negative-seq.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/embedded-negative-seq.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -213,8 +223,9 @@
     @Test
     public void testNegativeEmbeddedSequenceWithClass () throws QueryException {
         // submatch(0,1:{1:[base != Baum] dass})
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-negative-class-seq.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/submatch/embedded-negative-class-seq.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -227,8 +238,9 @@
     @Test
     public void testEmbeddedNegativeRepetition () throws QueryException {
         // submatch(1,1:das [base != Baum]{1,3})
-        String filepath = getClass().getResource(
-                "/queries/submatch/embedded-negative-repetition.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/submatch/embedded-negative-repetition.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -241,8 +253,9 @@
     @Test
     public void testNegativeRepetition () throws QueryException {
         // das submatch(1,4:[base != Baum]{1,3})
-        String filepath = getClass().getResource(
-                "/queries/submatch/negative-repetition.jsonld").getFile();
+        String filepath = getClass()
+                .getResource("/queries/submatch/negative-repetition.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java
index 7e146ad..10b80c7 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithAttributeJSON.java
@@ -13,8 +13,10 @@
 
     @Test
     public void testElementSingleAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/element-single-attribute.jsonld").getFile();
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/element-single-attribute.jsonld")
+                .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
         assertEquals(
@@ -25,8 +27,9 @@
 
     @Test
     public void testElementSingleNotAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/element-single-not-attribute.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/element-single-not-attribute.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -53,8 +56,9 @@
 
     @Test
     public void testElementMultipleOrAttributes () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/element-multiple-or-attributes.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/element-multiple-or-attributes.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -68,8 +72,9 @@
 
     @Test
     public void testAnyElementWithAttribute () throws QueryException {
-        String filepath = getClass().getResource(
-                "/queries/attribute/any-element-with-attribute.jsonld")
+        String filepath = getClass()
+                .getResource(
+                        "/queries/attribute/any-element-with-attribute.jsonld")
                 .getFile();
         SpanQueryWrapper sqwi = getJSONQuery(filepath);
         SpanQuery sq = sqwi.toQuery();
@@ -79,7 +84,8 @@
 
 
     @Test
-    public void testAnyElementWithMultipleOrAttributes () throws QueryException {
+    public void testAnyElementWithMultipleOrAttributes ()
+            throws QueryException {
         String filepath = getClass()
                 .getResource(
                         "/queries/attribute/any-element-with-multiple-or-attributes.jsonld")
@@ -95,7 +101,8 @@
 
 
     @Test
-    public void testAnyElementMultipleAndNotAttributes () throws QueryException {
+    public void testAnyElementMultipleAndNotAttributes ()
+            throws QueryException {
         String filepath = getClass()
                 .getResource(
                         "/queries/attribute/any-element-with-multiple-and-not-attributes.jsonld")
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
index 114ea99..24f296c 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
@@ -18,8 +18,8 @@
     @Test
     public void spanSegmentWithinQuery () throws QueryException {
 
-        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper(
-                "field", "a", "b", "c");
+        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper("field",
+                "a", "b", "c");
         SpanWithinQuery ssequery = new SpanWithinQuery("s", ssquery.toQuery());
 
         assertEquals(
@@ -37,11 +37,11 @@
     @Test
     public void spanSegmentStartsWithQuery () throws QueryException {
 
-        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper(
-                "field", "a", "b", "c");
-        SpanWithinQuery ssequery = new SpanWithinQuery(new SpanElementQuery(
-                "field", "s"), ssquery.toQuery(), SpanWithinQuery.STARTSWITH,
-                true);
+        SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper("field",
+                "a", "b", "c");
+        SpanWithinQuery ssequery = new SpanWithinQuery(
+                new SpanElementQuery("field", "s"), ssquery.toQuery(),
+                SpanWithinQuery.STARTSWITH, true);
 
         assertEquals(
                 "spanStartsWith(<field:s />, spanNext(spanNext(field:a, field:b), field:c))",
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java b/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
index d651318..20cd49f 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestTemporaryQueryLimitations.java
@@ -33,7 +33,8 @@
 public class TestTemporaryQueryLimitations {
 
     @Test
-    public void classRefCheckNotSupported () throws IOException, QueryException {
+    public void classRefCheckNotSupported ()
+            throws IOException, QueryException {
 
         // Construct index
         KrillIndex ki = new KrillIndex();
@@ -48,8 +49,9 @@
         FieldDocument fd = ki.addDoc(json);
         ki.commit();
 
-        json = getJsonString(getClass().getResource(
-                "/queries/bugs/cosmas_classrefcheck.jsonld").getFile());
+        json = getJsonString(getClass()
+                .getResource("/queries/bugs/cosmas_classrefcheck.jsonld")
+                .getFile());
 
         Krill ks = new Krill(json);
         Result kr = ks.apply(ki);
@@ -58,12 +60,13 @@
         assertEquals(kr.getTotalResults(), 0);
         assertEquals(kr.getStartIndex(), 0);
 
-        assertEquals("This is a warning coming from the serialization", kr
-                .getWarning(1).getMessage());
+        assertEquals("This is a warning coming from the serialization",
+                kr.getWarning(1).getMessage());
 
-        assertEquals("Class reference checks are currently not supported"
-                + " - results may not be correct", kr.getWarning(0)
-                .getMessage());
+        assertEquals(
+                "Class reference checks are currently not supported"
+                        + " - results may not be correct",
+                kr.getWarning(0).getMessage());
 
         assertEquals(2, kr.getWarnings().size());
     };