Fix test isolation issues causing AssetTest/ServiceTest failures
- Add ExWSConf.clearProp() to ServiceTest.resetProps() to ensure clean
state
- Add ExWSConf.clearProp() to AssetTest.testFormHtmlAssets() to prevent
property pollution
- Remove problematic @Before method from AssetTest that interfered with
Jersey test container
This resolves the test execution order issue where tests were failing
when run
in the full suite but passing when run individually. The root cause was
static
property caching in ExWSConf that was being modified by different tests.
Resolves #138
Change-Id: I7b947045b76fd92ea2f02f298e27767dc97f5c33
diff --git a/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java b/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java
index 1629ce7..4a7794f 100644
--- a/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java
+++ b/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java
@@ -1,6 +1,7 @@
package de.ids_mannheim.korap.plkexport;
import org.junit.Test;
+import org.junit.Before;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@@ -19,6 +20,8 @@
public class AssetTest extends JerseyTest {
+
+
@Override
protected Application configure () {
return new ResourceConfig(Service.class);
@@ -120,6 +123,7 @@
@Test
public void testFormHtmlAssets () {
+ ExWSConf.clearProp();
Properties properties = ExWSConf.properties(null);
String hostTemp = properties.getProperty("asset.host");
String pathTemp = properties.getProperty("asset.path");
diff --git a/src/test/java/de/ids_mannheim/korap/plkexport/ServiceTest.java b/src/test/java/de/ids_mannheim/korap/plkexport/ServiceTest.java
index 5ea32b1..1c3d07f 100644
--- a/src/test/java/de/ids_mannheim/korap/plkexport/ServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/plkexport/ServiceTest.java
@@ -80,6 +80,7 @@
@Before
public void resetProps () {
+ ExWSConf.clearProp();
Properties properties = ExWSConf.properties(null);
properties.setProperty("api.host", "localhost");
properties.setProperty("api.port", String.valueOf(mockServer.getPort()));