diff --git a/src/test/java/FoundryRewriteTest.java b/src/test/java/FoundryRewriteTest.java
index a437208..c9e63f2 100644
--- a/src/test/java/FoundryRewriteTest.java
+++ b/src/test/java/FoundryRewriteTest.java
@@ -3,9 +3,6 @@
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
 import de.ids_mannheim.korap.resource.LayerMapper;
-import de.ids_mannheim.korap.resource.RewriteProcessor;
-import de.ids_mannheim.korap.resource.rewrite.CollectionCleanupFilter;
-import de.ids_mannheim.korap.resource.rewrite.CollectionConstraint;
 import de.ids_mannheim.korap.resource.rewrite.FoundryInject;
 import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -35,10 +32,11 @@
 
     @Test
     public void testSimpleFoundryAddThrowsNoError() {
-        RewriteProcessor processor = new RewriteProcessor(config);
+        RewriteHandler processor = new RewriteHandler();
+        processor.add(new FoundryInject(config));
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
-        String result = processor.process(s.toJSON());
+        String result = processor.apply(s.toJSON(), null);
         JsonNode node = JsonUtils.readTree(result);
 
         assert node != null;
@@ -113,100 +111,4 @@
         assert node.at("/query/wrap/operands/1/rewrites").isMissingNode();
     }
 
-    @Test
-    public void testCollectionNodeRemoveCorpusIdNoErrors() {
-        RewriteHandler handler = new RewriteHandler();
-        handler.add(new CollectionConstraint());
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection("textClass=politik & corpusID=WPD");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.apply(result, null));
-        assert node != null;
-        assert node.at("/collection/operands").size() == 1;
-    }
-
-    @Test
-    public void testCollectionNodeRemoveAllCorpusIdNoErrors() {
-        RewriteHandler handler = new RewriteHandler();
-        handler.add(new CollectionConstraint());
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection("corpusID=BRZ13 & corpusID=WPD");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.apply(result, null));
-
-        assert node != null;
-        assert node.at("/collection/operands").size() == 0;
-    }
-
-    @Test
-    public void testCollectionNodeRemoveGroupedCorpusIdNoErrors() {
-        RewriteHandler handler = new RewriteHandler();
-        handler.add(new CollectionConstraint());
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(corpusID=BRZ13 & textClass=Wissenschaft) & corpusID=WPD");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.apply(result, null));
-
-        assert node != null;
-        assert node.at("/collection/operands/0/@type").asText()
-                .equals("koral:docGroup");
-        assert node.at("/collection/operands/0/operands/0/key").asText()
-                .equals("textClass");
-    }
-
-    //fixme: will probably fail when one doc groups are being refactored
-    @Test
-    public void testCollectionCleanEmptyDocGroupNoErrors() {
-        RewriteHandler handler = new RewriteHandler();
-        handler.add(new CollectionConstraint());
-        handler.add(new CollectionCleanupFilter());
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft & textClass=Sport");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.apply(result, null));
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:docGroup");
-        assert node.at("/collection/operands").size() == 2;
-        assert node.at("/collection/operands/0/key").asText()
-                .equals("textClass");
-        assert node.at("/collection/operands/1/key").asText()
-                .equals("textClass");
-    }
-
-    @Test
-    public void testCollectionCleanMoveOneDocFromGroupUpNoErrors() {
-        RewriteHandler handler = new RewriteHandler();
-        handler.add(new CollectionConstraint());
-        handler.add(new CollectionCleanupFilter());
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection("(corpusID=BRZ13 & textClass=Wissenschaft)");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.apply(result, null));
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:doc");
-    }
-
-    @Test
-    public void testCollectionCleanEmptyGroupAndMoveOneDocFromGroupUpNoErrors() {
-        RewriteHandler handler = new RewriteHandler();
-        handler.add(new CollectionConstraint());
-        handler.add(new CollectionCleanupFilter());
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.apply(result, null));
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:doc");
-        assert node.at("/collection/key").asText().equals("textClass");
-    }
-
 }
