nullpointer in specific user constructor bug fix
diff --git a/src/test/java/ClassLoaderTest.java b/src/test/java/ClassLoaderTest.java
index 4f9e455..207ef81 100644
--- a/src/test/java/ClassLoaderTest.java
+++ b/src/test/java/ClassLoaderTest.java
@@ -1,5 +1,5 @@
import de.ids_mannheim.korap.config.BeanConfiguration;
-import de.ids_mannheim.korap.config.PluginHandler;
+import de.ids_mannheim.korap.config.DefaultHandler;
import de.ids_mannheim.korap.interfaces.AuditingIface;
import de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing;
import org.junit.Test;
@@ -18,9 +18,10 @@
@Test
public void testDefaultCreationThrowsNoException() {
- PluginHandler pl = new PluginHandler();
+ DefaultHandler pl = new DefaultHandler();
Object o = pl.getDefault(BeanConfiguration.KUSTVAKT_AUDITING);
assert o != null;
+ assert o instanceof AuditingIface;
}
@Test(expected = RuntimeException.class)
diff --git a/src/test/java/RewriteTest.java b/src/test/java/RewriteTest.java
index f06390e..7835ca1 100644
--- a/src/test/java/RewriteTest.java
+++ b/src/test/java/RewriteTest.java
@@ -4,7 +4,10 @@
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.*;
+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;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -37,6 +40,8 @@
s.setQuery(simple_add_query, "poliqarp");
String result = processor.process(s.toJSON());
JsonNode node = JsonUtils.readTree(result);
+
+ assert node != null;
assert !node.at("/query/wrap/foundry").isMissingNode();
}
@@ -59,6 +64,8 @@
handler.add(new FoundryInject(config));
String result = handler.apply(s.toJSON(), null);
JsonNode node = JsonUtils.readTree(result);
+
+ assert node != null;
assert !node.at("/query/wrap/foundry").isMissingNode();
assert !node.at("/query/wrap/rewrites").isMissingNode();
assert node.at("/query/wrap/rewrites/0/@type").asText()
@@ -73,6 +80,8 @@
handler.add(new FoundryInject(config));
String result = handler.apply(s.toJSON(), null);
JsonNode node = JsonUtils.readTree(result);
+
+ assert node != null;
assert node.at("/query/wrap/@type").asText().equals("koral:termGroup");
assert !node.at("/query/wrap/operands/0/foundry").isMissingNode();
assert !node.at("/query/wrap/operands/0/rewrites").isMissingNode();
@@ -89,6 +98,7 @@
String result = handler.apply(s.toJSON(), null);
JsonNode node = JsonUtils.readTree(result);
+ assert node != null;
assert node.at("/query/wrap/@type").asText().equals("koral:termGroup");
assert !node.at("/query/wrap/operands/0/operands/0/foundry")
.isMissingNode();
@@ -112,6 +122,7 @@
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;
}
@@ -124,6 +135,8 @@
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;
}
@@ -138,6 +151,7 @@
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()
@@ -156,6 +170,7 @@
"(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()
@@ -174,6 +189,7 @@
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");
}
@@ -188,6 +204,7 @@
"(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");
}
diff --git a/src/test/java/FastJerseyTest.java b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
similarity index 98%
rename from src/test/java/FastJerseyTest.java
rename to src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index c51e62c..f3a0a04 100644
--- a/src/test/java/FastJerseyTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -1,3 +1,5 @@
+package de.ids_mannheim.korap.web.service;
+
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.core.DefaultResourceConfig;
diff --git a/src/test/java/KustvaktCoreRestTest.java b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
similarity index 97%
rename from src/test/java/KustvaktCoreRestTest.java
rename to src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
index 11a935a..88ad2bf 100644
--- a/src/test/java/KustvaktCoreRestTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
@@ -1,8 +1,9 @@
+package de.ids_mannheim.korap.web.service;
+
import com.sun.jersey.api.client.ClientResponse;
import de.ids_mannheim.korap.config.BeanConfiguration;
import de.ids_mannheim.korap.query.serialize.CollectionQueryProcessor;
import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.web.service.LightService;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;