diff --git a/pom.xml b/pom.xml
index c7233b41..866e29e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -496,10 +496,6 @@
jakarta.xml.bind
jakarta.xml.bind-api
-
- junit
- junit
-
org.apache.commons
commons-compress
@@ -635,8 +631,13 @@
test
- org.junit.vintage
- junit-vintage-engine
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
test
diff --git a/src/test/java/de/urmel_dl/dbt/media/TestMediaServiceResource.java b/src/test/java/de/urmel_dl/dbt/media/TestMediaServiceResource.java
index 92a20a95..552a68ed 100644
--- a/src/test/java/de/urmel_dl/dbt/media/TestMediaServiceResource.java
+++ b/src/test/java/de/urmel_dl/dbt/media/TestMediaServiceResource.java
@@ -18,8 +18,8 @@
*/
package de.urmel_dl.dbt.media;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.time.Instant;
import java.util.ArrayList;
@@ -32,8 +32,8 @@
import jakarta.ws.rs.core.Response;
import org.glassfish.jersey.server.ResourceConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mycore.common.config.MCRConfiguration2;
import de.urmel_dl.dbt.media.entity.ConverterJob;
@@ -59,7 +59,7 @@ protected Application configure() {
}
@Override
- @Before()
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
diff --git a/src/test/java/de/urmel_dl/dbt/opc/TestOPCConnector.java b/src/test/java/de/urmel_dl/dbt/opc/TestOPCConnector.java
index 91968491..6aea57e7 100644
--- a/src/test/java/de/urmel_dl/dbt/opc/TestOPCConnector.java
+++ b/src/test/java/de/urmel_dl/dbt/opc/TestOPCConnector.java
@@ -17,13 +17,12 @@
*/
package de.urmel_dl.dbt.opc;
-import static org.junit.Assert.assertNotNull;
-
import org.jdom2.Document;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mycore.test.MyCoReTest;
import de.urmel_dl.dbt.opc.datamodel.Catalog;
import de.urmel_dl.dbt.opc.datamodel.Catalogues;
@@ -36,7 +35,8 @@
* @author Ren\u00E9 Adler (eagle)
*
*/
-public class TestOPCConnector extends MCRTestCase {
+@MyCoReTest
+public class TestOPCConnector {
private final String OPC_URL = "https://opac.lbs-ilmenau.gbv.de";
@@ -46,7 +46,7 @@ public class TestOPCConnector extends MCRTestCase {
public void testIKTList() throws Exception {
OPCConnector opc = new OPCConnector(OPC_URL, OPC_DB);
IKTList iktList = opc.getIKTList();
- assertNotNull(iktList);
+ Assertions.assertNotNull(iktList);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(iktList).toDocument(), System.out);
}
@@ -55,7 +55,7 @@ public void testIKTList() throws Exception {
public void testSearchWoIKT() throws Exception {
OPCConnector opc = new OPCConnector(OPC_URL, OPC_DB);
Result result = opc.search("papula");
- assertNotNull(result);
+ Assertions.assertNotNull(result);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(result).toDocument(), System.out);
}
@@ -64,7 +64,7 @@ public void testSearchWoIKT() throws Exception {
public void testSearchWIKT() throws Exception {
OPCConnector opc = new OPCConnector(OPC_URL, OPC_DB);
Result result = opc.search("papula", "1004");
- assertNotNull(result);
+ Assertions.assertNotNull(result);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(result).toDocument(), System.out);
}
@@ -73,7 +73,7 @@ public void testSearchWIKT() throws Exception {
public void testFamily() throws Exception {
OPCConnector opc = new OPCConnector(OPC_URL, OPC_DB);
Result result = opc.family("785761829");
- assertNotNull(result);
+ Assertions.assertNotNull(result);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(result).toDocument(), System.out);
}
@@ -82,7 +82,7 @@ public void testFamily() throws Exception {
public void testRecord() throws Exception {
OPCConnector opc = new OPCConnector(OPC_URL, OPC_DB);
Record record = opc.getRecord("785761829");
- assertNotNull(record);
+ Assertions.assertNotNull(record);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(record).toDocument(), System.out);
}
@@ -91,7 +91,7 @@ public void testRecord() throws Exception {
public void testRecordBasicCopy() throws Exception {
OPCConnector opc = new OPCConnector(OPC_URL, OPC_DB);
Record record = opc.getRecord("785761829");
- assertNotNull(record);
+ Assertions.assertNotNull(record);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(record.getBasicCopy()).toDocument(),
System.out);
@@ -100,7 +100,7 @@ public void testRecordBasicCopy() throws Exception {
@Test
public void testCatalogues() throws Exception {
Catalogues catalogues = Catalogues.instance();
- assertNotNull(catalogues);
+ Assertions.assertNotNull(catalogues);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(catalogues).toDocument(), System.out);
}
@@ -115,6 +115,6 @@ public void testSetCatalog() throws Exception {
Document doc = new EntityFactory<>(result).toDocument();
- assertNotNull(doc.getRootElement().getAttribute("catalogId"));
+ Assertions.assertNotNull(doc.getRootElement().getAttribute("catalogId"));
}
}
diff --git a/src/test/java/de/urmel_dl/dbt/opc/TestOPCResolver.java b/src/test/java/de/urmel_dl/dbt/opc/TestOPCResolver.java
index 0f3654ad..b6160db1 100644
--- a/src/test/java/de/urmel_dl/dbt/opc/TestOPCResolver.java
+++ b/src/test/java/de/urmel_dl/dbt/opc/TestOPCResolver.java
@@ -17,22 +17,22 @@
*/
package de.urmel_dl.dbt.opc;
-import static org.junit.Assert.assertNotNull;
-
import java.io.IOException;
import org.jdom2.Element;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.mycore.common.xml.MCRURIResolver;
+import org.mycore.test.MyCoReTest;
/**
* @author René Adler (eagle)
*
*/
-public class TestOPCResolver extends MCRTestCase {
+@MyCoReTest
+public class TestOPCResolver {
private final String OPC_URL = "http://opac.lbs-ilmenau.gbv.de";
@@ -41,21 +41,21 @@ public class TestOPCResolver extends MCRTestCase {
@Test
public void testIKTList() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve("opc:url=" + OPC_URL + "&db=" + OPC_DB + "&iktList");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@Test
public void testSearch() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve("opc:url=" + OPC_URL + "&db=" + OPC_DB + "&search=papula");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@Test
public void testSearchWoDB() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve("opc:url=" + OPC_URL + "&search=papula");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@@ -63,21 +63,21 @@ public void testSearchWoDB() throws IOException {
public void testSearchIKT() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve(
"opc:url=" + OPC_URL + "&db=" + OPC_DB + "&search=papula&ikt=1004");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@Test
public void testFamily() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve("opc:url=" + OPC_URL + "&db=" + OPC_DB + "&family=785761829");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@Test
public void testRecord() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve("opc:url=" + OPC_URL + "&db=" + OPC_DB + "&record=785761829");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@@ -85,7 +85,7 @@ public void testRecord() throws IOException {
public void testRecordBasicCopy() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve(
"opc:url=" + OPC_URL + "&db=" + OPC_DB + "&record=785761829©s=false");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@@ -93,7 +93,7 @@ public void testRecordBasicCopy() throws IOException {
public void testBarcode() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve(
"opc:url=" + OPC_URL + "&db=" + OPC_DB + "&barcode=ILM1$005419999");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@@ -101,7 +101,7 @@ public void testBarcode() throws IOException {
public void testBarcodeBasicCopy() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve(
"opc:url=" + OPC_URL + "&db=" + OPC_DB + "&barcode=ILM1$005419999©s=false");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
@@ -110,7 +110,7 @@ public void testPica2Mods() throws Exception {
Element xml = MCRURIResolver.obtainInstance().resolve(
"xslStyle:opc/transform/pica2mods?RecordIdSource=DE-ILM1"
+ ":opc:url=" + OPC_URL + "&db=" + OPC_DB + "&record=729763749");
- assertNotNull(xml);
+ Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}
}
diff --git a/src/test/java/de/urmel_dl/dbt/opc/TestOPCResource.java b/src/test/java/de/urmel_dl/dbt/opc/TestOPCResource.java
index 4e1f0b40..a9771132 100644
--- a/src/test/java/de/urmel_dl/dbt/opc/TestOPCResource.java
+++ b/src/test/java/de/urmel_dl/dbt/opc/TestOPCResource.java
@@ -18,9 +18,6 @@
*/
package de.urmel_dl.dbt.opc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -33,8 +30,11 @@
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mycore.common.MCRTestConfiguration;
+import org.mycore.common.MCRTestProperty;
import org.mycore.common.config.MCRConfiguration2;
import de.urmel_dl.dbt.opc.datamodel.Catalogues;
@@ -51,9 +51,14 @@
import jakarta.ws.rs.core.Response;
/**
- * @author Ren\u00E9 Adler (eagle)
+ * @author René Adler (eagle)
*
*/
+@MCRTestConfiguration(
+ properties = {
+ @MCRTestProperty(key="DBT.EntityFactory.Marshaller.eclipselink.json.include-root", string="true")
+ }
+)
public class TestOPCResource extends JerseyTestCase {
private WebTarget webResource;
@@ -63,11 +68,9 @@ protected Application configure() {
return new ResourceConfig(OPCResource.class, EntityMessageBodyWriter.class);
}
- @Override
- @Before()
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
- MCRConfiguration2.set("DBT.EntityFactory.Marshaller.eclipselink.json.include-root", "true");
webResource = target();
}
@@ -75,10 +78,10 @@ public void setUp() throws Exception {
public void testCatalogues() {
Stream.of(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML).forEach(mt -> {
String response = webResource.path("opc/catalogues").request(mt).get(String.class);
- assertNotNull(response);
+ Assertions.assertNotNull(response);
Catalogues catalogues = new EntityFactory<>(Catalogues.class).unmarshalByMediaType(response, mt);
- assertNotNull(catalogues);
+ Assertions.assertNotNull(catalogues);
});
}
@@ -87,10 +90,10 @@ public void testIKTs() {
Stream.of(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML).forEach(mt -> {
Stream.of("", "/DE-27").forEach(cat -> {
String response = webResource.path("opc/ikts" + cat).request(mt).get(String.class);
- assertNotNull(response);
+ Assertions.assertNotNull(response);
IKTList ikts = new EntityFactory<>(IKTList.class).unmarshalByMediaType(response, mt);
- assertNotNull(ikts);
+ Assertions.assertNotNull(ikts);
});
});
}
@@ -102,7 +105,7 @@ public void testSearch() {
Stream.of("", "/4").forEach(ikt -> {
String response = webResource.path("opc/search" + cat + ikt + "/duden").request(mt)
.get(String.class);
- assertNotNull(response);
+ Assertions.assertNotNull(response);
});
});
});
@@ -114,11 +117,11 @@ public void testRecord() {
Stream.of(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML).forEach(mt -> {
Stream.of("", "/DE-27").forEach(cat -> {
String response = webResource.path("opc/record" + cat + "/" + PPN).request(mt).get(String.class);
- assertNotNull(response);
+ Assertions.assertNotNull(response);
Record record = new EntityFactory<>(Record.class).unmarshalByMediaType(response, mt);
- assertNotNull("Could not transform response to record: " + response, record);
- assertEquals(PPN, record.getPPN());
+ Assertions.assertNotNull(record, "Could not transform response to record: " + response);
+ Assertions.assertEquals(PPN, record.getPPN());
});
});
}
@@ -129,7 +132,7 @@ public void testNullRecord() {
Stream.of(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML).forEach(mt -> {
Stream.of("", "/DE-27").forEach(cat -> {
Response response = webResource.path("opc/record" + cat + "/" + PPN).request(mt).head();
- assertEquals(204, response.getStatus());
+ Assertions.assertEquals(204, response.getStatus());
});
});
}
@@ -140,7 +143,7 @@ public void testFamily() {
Stream.of(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML).forEach(mt -> {
Stream.of("", "/DE-27").forEach(cat -> {
String response = webResource.path("opc/family" + cat + "/" + PPN).request(mt).get(String.class);
- assertNotNull(response);
+ Assertions.assertNotNull(response);
});
});
}
@@ -157,7 +160,7 @@ public void testMods() {
} catch (WebApplicationException e) {
LogManager.getLogger().error(e.getResponse().readEntity(String.class));
}
- assertNotNull(response);
+ Assertions.assertNotNull(response);
try {
SAXBuilder builder = new SAXBuilder();
diff --git a/src/test/java/de/urmel_dl/dbt/pi/DBTMapObjectIDURNGeneratorTest.java b/src/test/java/de/urmel_dl/dbt/pi/DBTMapObjectIDURNGeneratorTest.java
index c932542c..25cc6fd7 100644
--- a/src/test/java/de/urmel_dl/dbt/pi/DBTMapObjectIDURNGeneratorTest.java
+++ b/src/test/java/de/urmel_dl/dbt/pi/DBTMapObjectIDURNGeneratorTest.java
@@ -2,48 +2,46 @@
import java.util.Map;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mycore.common.MCRTestConfiguration;
+import org.mycore.common.MCRTestProperty;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.datamodel.metadata.MCRObjectID;
import org.mycore.pi.exceptions.MCRPersistentIdentifierException;
import org.mycore.pi.urn.MCRDNBURN;
+import org.mycore.test.MyCoReTest;
-public class DBTMapObjectIDURNGeneratorTest extends MCRTestCase {
+@MyCoReTest
+@MCRTestConfiguration(
+ properties = {
+ @MCRTestProperty(key = "MCR.PI.Generator.Test", empty = true),
+ @MCRTestProperty(key = "MCR.PI.Generator.Test.Prefix.dbt_mods", string = "urn:nbn:de:test-dbt-")
+ })
+public class DBTMapObjectIDURNGeneratorTest {
- private static final String CONFIG_PREFIX = "MCR.PI.Generator.Test";
DBTMapObjectIDURNGenerator generator;
- @Override
- protected Map getTestProperties() {
- Map testProperties = super.getTestProperties();
- testProperties.put(CONFIG_PREFIX, "");
- testProperties.put(CONFIG_PREFIX+".Prefix.dbt_mods", "urn:nbn:de:test-dbt-");
- return testProperties;
- }
-
- @Before
+ @BeforeEach
public void setUp() throws Exception {
- super.setUp();
generator = new DBTMapObjectIDURNGenerator();
- generator.init(CONFIG_PREFIX);
- Map subPropertiesMap = MCRConfiguration2.getSubPropertiesMap(CONFIG_PREFIX+".");
+ generator.init("MCR.PI.Generator.Test");
+ Map subPropertiesMap = MCRConfiguration2.getSubPropertiesMap("MCR.PI.Generator.Test" + ".");
System.out.println(subPropertiesMap);
generator.setProperties(subPropertiesMap);
}
@Test
public void getNamespace() {
- Assert.assertEquals("urn:nbn:de:test",generator.getNamespace("test"));
- Assert.assertEquals("urn:nbn:de:test",generator.getNamespace("urn:nbn:de:test"));
+ Assertions.assertEquals("urn:nbn:de:test", generator.getNamespace("test"));
+ Assertions.assertEquals("urn:nbn:de:test", generator.getNamespace("urn:nbn:de:test"));
}
@Test
public void buildURN() throws MCRPersistentIdentifierException {
- MCRObjectID mcrObjectID=MCRObjectID.getInstance("dbt_mods_4711");
+ MCRObjectID mcrObjectID = MCRObjectID.getInstance("dbt_mods_4711");
MCRDNBURN urn = generator.buildURN(mcrObjectID, "");
- Assert.assertEquals("urn:nbn:de:test-dbt-4711-2",urn.asString());
+ Assertions.assertEquals("urn:nbn:de:test-dbt-4711-2", urn.asString());
}
}
diff --git a/src/test/java/de/urmel_dl/dbt/rc/TestPeriod.java b/src/test/java/de/urmel_dl/dbt/rc/TestPeriod.java
index bb090000..437124cf 100644
--- a/src/test/java/de/urmel_dl/dbt/rc/TestPeriod.java
+++ b/src/test/java/de/urmel_dl/dbt/rc/TestPeriod.java
@@ -17,17 +17,15 @@
*/
package de.urmel_dl.dbt.rc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
import java.io.IOException;
import java.util.Date;
import org.jdom2.Document;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mycore.test.MyCoReTest;
import de.urmel_dl.dbt.rc.datamodel.Period;
import de.urmel_dl.dbt.rc.utils.DateUtils;
@@ -36,10 +34,11 @@
/**
* The {@link Period} test cases.
*
- * @author Ren\u00E9 Adler (eagle)
+ * @author René Adler (eagle)
*
*/
-public class TestPeriod extends MCRTestCase {
+@MyCoReTest
+public class TestPeriod {
@Test
public void testPeriod() throws IOException {
@@ -48,17 +47,17 @@ public void testPeriod() throws IOException {
period.setFrom("01.10.");
period.setTo("31.03.");
- assertEquals("01.10.", period.getFrom());
- assertEquals("31.03.", period.getTo());
+ Assertions.assertEquals("01.10.", period.getFrom());
+ Assertions.assertEquals("31.03.", period.getTo());
period.setSettableFrom("21.07.");
period.setSettableTo("02.02.");
- assertEquals("21.07.", period.getSettableFrom());
- assertEquals("02.02.", period.getSettableTo());
+ Assertions.assertEquals("21.07.", period.getSettableFrom());
+ Assertions.assertEquals("02.02.", period.getSettableTo());
period.setLectureEnd("02.03.");
- assertEquals("02.03.", period.getLectureEnd());
+ Assertions.assertEquals("02.03.", period.getLectureEnd());
}
@Test
@@ -75,17 +74,17 @@ public void testPeriodFQFromAfterTo() throws IOException {
period.setFrom("01.10.");
period.setTo("31.03.");
- assertEquals("01.10." + year, period.getFrom());
- assertEquals("31.03." + (year + 1), period.getTo());
+ Assertions.assertEquals("01.10." + year, period.getFrom());
+ Assertions.assertEquals("31.03." + (year + 1), period.getTo());
period.setSettableFrom("21.07.");
period.setSettableTo("02.02.");
- assertEquals("21.07." + year, period.getSettableFrom());
- assertEquals("02.02." + (year + 1), period.getSettableTo());
+ Assertions.assertEquals("21.07." + year, period.getSettableFrom());
+ Assertions.assertEquals("02.02." + (year + 1), period.getSettableTo());
period.setLectureEnd("02.03.");
- assertEquals("02.03." + (year + 1), period.getLectureEnd());
+ Assertions.assertEquals("02.03." + (year + 1), period.getLectureEnd());
}
@Test
@@ -102,17 +101,17 @@ public void testPeriodFQToAfterFrom() throws IOException {
period.setFrom("01.04.");
period.setTo("30.09.");
- assertEquals("01.04." + year, period.getFrom());
- assertEquals("30.09." + year, period.getTo());
+ Assertions.assertEquals("01.04." + year, period.getFrom());
+ Assertions.assertEquals("30.09." + year, period.getTo());
period.setSettableFrom("03.02.");
period.setSettableTo("20.07.");
- assertEquals("03.02." + year, period.getSettableFrom());
- assertEquals("20.07." + year, period.getSettableTo());
+ Assertions.assertEquals("03.02." + year, period.getSettableFrom());
+ Assertions.assertEquals("20.07." + year, period.getSettableTo());
period.setLectureEnd("03.08.");
- assertEquals("03.08." + year, period.getLectureEnd());
+ Assertions.assertEquals("03.08." + year, period.getLectureEnd());
}
@Test
@@ -120,10 +119,10 @@ public void testPeriodFromShort() throws IOException {
Period period = new Period();
period.setFrom("01.10.");
- assertEquals("01.10.", period.getFrom());
+ Assertions.assertEquals("01.10.", period.getFrom());
period.setFrom("01.12.");
- assertEquals("01.12.", period.getFrom());
+ Assertions.assertEquals("01.12.", period.getFrom());
}
@Test
@@ -131,10 +130,10 @@ public void testPeriodFromLong() throws IOException {
Period period = new Period();
period.setFrom("01.10.2014");
- assertEquals("01.10.", period.getFrom());
+ Assertions.assertEquals("01.10.", period.getFrom());
period.setFrom("01.12.2014");
- assertEquals("01.12.", period.getFrom());
+ Assertions.assertEquals("01.12.", period.getFrom());
}
@Test
@@ -142,10 +141,10 @@ public void testPeriodToShort() throws IOException {
Period period = new Period();
period.setTo("01.10.");
- assertEquals("01.10.", period.getTo());
+ Assertions.assertEquals("01.10.", period.getTo());
period.setTo("01.12.");
- assertEquals("01.12.", period.getTo());
+ Assertions.assertEquals("01.12.", period.getTo());
}
@Test
@@ -153,10 +152,10 @@ public void testPeriodToLong() throws IOException {
Period period = new Period();
period.setTo("01.10.2014");
- assertEquals("01.10.", period.getTo());
+ Assertions.assertEquals("01.10.", period.getTo());
period.setTo("01.12.2014");
- assertEquals("01.12.", period.getTo());
+ Assertions.assertEquals("01.12.", period.getTo());
}
@Test
@@ -165,11 +164,11 @@ public void testPeriodSetableFromShort() throws IOException {
period.setSettableFrom("01.10.");
period.setSettableTo("02.10.");
- assertEquals("01.10.", period.getSettableFrom());
+ Assertions.assertEquals("01.10.", period.getSettableFrom());
period.setSettableFrom("01.12.");
period.setSettableTo("02.12.");
- assertEquals("01.12.", period.getSettableFrom());
+ Assertions.assertEquals("01.12.", period.getSettableFrom());
}
@Test
@@ -178,11 +177,11 @@ public void testPeriodSetableFromLong() throws IOException {
period.setSettableFrom("01.10.2014");
period.setSettableTo("02.10.2014");
- assertEquals("01.10.", period.getSettableFrom());
+ Assertions.assertEquals("01.10.", period.getSettableFrom());
period.setSettableFrom("01.12.2014");
period.setSettableTo("02.12.2014");
- assertEquals("01.12.", period.getSettableFrom());
+ Assertions.assertEquals("01.12.", period.getSettableFrom());
}
@Test
@@ -191,11 +190,11 @@ public void testPeriodSetableToShort() throws IOException {
period.setSettableFrom("01.10.");
period.setSettableTo("02.10.");
- assertEquals("02.10.", period.getSettableTo());
+ Assertions.assertEquals("02.10.", period.getSettableTo());
period.setSettableFrom("30.11.");
period.setSettableTo("01.12.");
- assertEquals("01.12.", period.getSettableTo());
+ Assertions.assertEquals("01.12.", period.getSettableTo());
}
@Test
@@ -204,11 +203,11 @@ public void testPeriodSetableToLong() throws IOException {
period.setSettableFrom("01.10.2014");
period.setSettableTo("01.10.2014");
- assertEquals("01.10.", period.getSettableTo());
+ Assertions.assertEquals("01.10.", period.getSettableTo());
period.setSettableFrom("30.11.2014");
period.setSettableTo("01.12.2014");
- assertEquals("01.12.", period.getSettableTo());
+ Assertions.assertEquals("01.12.", period.getSettableTo());
}
@Test
@@ -216,10 +215,10 @@ public void testPeriodLectureEndShort() throws IOException {
Period period = new Period();
period.setLectureEnd("01.10.");
- assertEquals("01.10.", period.getLectureEnd());
+ Assertions.assertEquals("01.10.", period.getLectureEnd());
period.setLectureEnd("01.12.");
- assertEquals("01.12.", period.getLectureEnd());
+ Assertions.assertEquals("01.12.", period.getLectureEnd());
}
@Test
@@ -227,10 +226,10 @@ public void testPeriodLectureEndLong() throws IOException {
Period period = new Period();
period.setLectureEnd("01.10.2014");
- assertEquals("01.10.", period.getLectureEnd());
+ Assertions.assertEquals("01.10.", period.getLectureEnd());
period.setLectureEnd("01.12.2014");
- assertEquals("01.12.", period.getLectureEnd());
+ Assertions.assertEquals("01.12.", period.getLectureEnd());
}
@Test
@@ -248,7 +247,7 @@ public void testPeriodTransform() throws IOException {
Document p = new EntityFactory<>(period).toDocument();
new XMLOutputter(Format.getPrettyFormat()).output(p, System.out);
- assertNotNull(p);
+ Assertions.assertNotNull(p);
}
@Test
@@ -274,6 +273,6 @@ public void testPeriodFQTransform() throws IOException {
Document p = new EntityFactory<>(period).toDocument();
new XMLOutputter(Format.getPrettyFormat()).output(p, System.out);
- assertNotNull(p);
+ Assertions.assertNotNull(p);
}
}
diff --git a/src/test/java/de/urmel_dl/dbt/rc/TestRCCalendar.java b/src/test/java/de/urmel_dl/dbt/rc/TestRCCalendar.java
index 25a60fd6..394e65ca 100644
--- a/src/test/java/de/urmel_dl/dbt/rc/TestRCCalendar.java
+++ b/src/test/java/de/urmel_dl/dbt/rc/TestRCCalendar.java
@@ -17,11 +17,6 @@
*/
package de.urmel_dl.dbt.rc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
@@ -30,10 +25,11 @@
import org.jdom2.Element;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Before;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mycore.common.xml.MCRURIResolver;
+import org.mycore.test.MyCoReTest;
import de.urmel_dl.dbt.rc.datamodel.Period;
import de.urmel_dl.dbt.rc.datamodel.RCCalendar;
@@ -44,15 +40,13 @@
*
* @author René Adler (eagle)
*/
-public class TestRCCalendar extends MCRTestCase {
+@MyCoReTest
+public class TestRCCalendar {
private static RCCalendar calendar;
- @Override
- @Before()
+ @BeforeEach
public void setUp() throws Exception {
- super.setUp();
-
if (calendar == null) {
calendar = RCCalendar.instance();
}
@@ -62,34 +56,34 @@ public void setUp() throws Exception {
public void testRCCalendarExport() throws IOException {
Document cal = new EntityFactory<>(calendar).toDocument();
new XMLOutputter(Format.getPrettyFormat()).output(cal, System.out);
- assertNotNull(cal);
+ Assertions.assertNotNull(cal);
}
@Test
public void testRCCalendarGetPeriod() throws IOException {
Period period = RCCalendar.getPeriod("2700", new Date());
- assertNotNull(period);
+ Assertions.assertNotNull(period);
Document p = new EntityFactory<>(period).toDocument();
new XMLOutputter(Format.getPrettyFormat()).output(p, System.out);
- assertNotNull(p);
+ Assertions.assertNotNull(p);
}
@Test
public void testRCCalendarGetSettable() throws IOException {
Period period = RCCalendar.getPeriodBySettable("2700", new Date());
- assertNotNull(period);
+ Assertions.assertNotNull(period);
Document p = new EntityFactory<>(period).toDocument();
new XMLOutputter(Format.getPrettyFormat()).output(p, System.out);
- assertNotNull(p);
+ Assertions.assertNotNull(p);
}
@Test
public void testPeriodResolverSingle() throws IOException {
Element input = MCRURIResolver.obtainInstance().resolve("period:areacode=0&date=now");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertNotNull(input);
+ Assertions.assertNotNull(input);
}
@Test
@@ -97,7 +91,8 @@ public void testPeriodResolverList() throws IOException {
Element input = MCRURIResolver.obtainInstance().resolve("period:areacode=0&date=now&list=true");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertTrue(Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
+ Assertions.assertTrue(
+ Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
}
@Test
@@ -106,7 +101,8 @@ public void testPeriodResolverListAll() throws IOException {
.resolve("period:areacode=0&date=31.03.2015&onlySettable=false&list=true");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertFalse(Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
+ Assertions.assertFalse(
+ Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
}
@Test
@@ -120,7 +116,7 @@ public void testPeriodResolverListFirstSemester() throws IOException, ParseExcep
.resolve("period:areacode=0&date=" + p.getSettableFrom() + "&list=true");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertEquals(2, input.getChildren("period").size());
+ Assertions.assertEquals(2, input.getChildren("period").size());
}
@Test
@@ -134,8 +130,9 @@ public void testPeriodResolverListSecondSemester() throws IOException, ParseExce
.resolve("period:areacode=0&date=" + p.getSettableFrom() + "&list=true");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertTrue(Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
- assertEquals(2, input.getChildren("period").size());
+ Assertions.assertTrue(
+ Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
+ Assertions.assertEquals(2, input.getChildren("period").size());
}
@Test
@@ -143,7 +140,7 @@ public void testPeriodResolverListMore() throws IOException {
Element input = MCRURIResolver.obtainInstance().resolve("period:areacode=0&date=now&list=true&numnext=2");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertEquals(3, input.getChildren("period").size());
+ Assertions.assertEquals(3, input.getChildren("period").size());
}
@Test
@@ -152,7 +149,8 @@ public void testPeriodResolverListMoreAll() throws IOException {
.resolve("period:areacode=0&date=30.09.2014&list=true&onlySettable=false&numnext=1");
new XMLOutputter(Format.getPrettyFormat()).output(input, System.out);
- assertFalse(Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
+ Assertions.assertFalse(
+ Boolean.parseBoolean(input.getChildren("period").getFirst().getAttributeValue("settable")));
int numbSettable = 0;
for (Element child : input.getChildren("period")) {
@@ -160,6 +158,6 @@ public void testPeriodResolverListMoreAll() throws IOException {
numbSettable++;
}
}
- assertEquals(2, numbSettable);
+ Assertions.assertEquals(2, numbSettable);
}
}
diff --git a/src/test/java/de/urmel_dl/dbt/rc/TestRCResource.java b/src/test/java/de/urmel_dl/dbt/rc/TestRCResource.java
index a2efb44b..e9988566 100644
--- a/src/test/java/de/urmel_dl/dbt/rc/TestRCResource.java
+++ b/src/test/java/de/urmel_dl/dbt/rc/TestRCResource.java
@@ -18,9 +18,9 @@
*/
package de.urmel_dl.dbt.rc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.text.ParseException;
@@ -36,10 +36,10 @@
import jakarta.ws.rs.core.MediaType;
import org.glassfish.jersey.server.ResourceConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mycore.test.MCRJPAExtension;
import de.urmel_dl.dbt.rc.datamodel.Lecturer;
import de.urmel_dl.dbt.rc.datamodel.PendingStatus;
@@ -60,6 +60,7 @@
* @author Ren\u00E9 Adler (eagle)
*
*/
+@ExtendWith(MCRJPAExtension.class)
public class TestRCResource extends JerseyTestCase {
private static final String TEST_SLOT_ID = "0027.01.01.0001";
@@ -68,16 +69,13 @@ public class TestRCResource extends JerseyTestCase {
private WebTarget webResource;
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
@Override
protected Application configure() {
return new ResourceConfig(RCResource.class, EntityMessageBodyWriter.class);
}
@Override
- @Before()
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
diff --git a/src/test/java/de/urmel_dl/dbt/rc/TestSlot.java b/src/test/java/de/urmel_dl/dbt/rc/TestSlot.java
index 4c45ddfb..728b7a89 100644
--- a/src/test/java/de/urmel_dl/dbt/rc/TestSlot.java
+++ b/src/test/java/de/urmel_dl/dbt/rc/TestSlot.java
@@ -17,11 +17,6 @@
*/
package de.urmel_dl.dbt.rc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -34,17 +29,15 @@
import org.jdom2.JDOMException;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mycore.access.MCRAccessException;
-import org.mycore.common.MCRJPATestCase;
import org.mycore.common.MCRPersistenceException;
import org.mycore.common.MCRSession;
import org.mycore.common.MCRSessionMgr;
import org.mycore.common.MCRSystemUserInformation;
-import org.mycore.common.config.MCRConfiguration2;
import org.mycore.common.xml.MCRURIResolver;
import org.mycore.datamodel.classifications2.MCRCategory;
import org.mycore.datamodel.classifications2.MCRCategoryDAO;
@@ -55,6 +48,10 @@
import org.mycore.datamodel.ifs2.MCRStoreCenter;
import org.mycore.datamodel.metadata.MCRMetadataManager;
import org.mycore.datamodel.metadata.MCRObject;
+import org.mycore.test.MCRJPAExtension;
+import org.mycore.test.MCRJPATestHelper;
+import org.mycore.test.MCRMetadataExtension;
+import org.mycore.test.MyCoReTest;
import org.xml.sax.SAXException;
import de.urmel_dl.dbt.rc.datamodel.Lecturer;
@@ -76,21 +73,17 @@
* @author René Adler (eagle)
*
*/
-public class TestSlot extends MCRJPATestCase {
+@MyCoReTest
+@ExtendWith(MCRJPAExtension.class)
+@ExtendWith(MCRMetadataExtension.class)
+public class TestSlot {
private static final MCRCategoryDAO DAO = new MCRCategoryDAOImpl();
private static SlotManager SLOT_MANAGER;
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Override
- @Before()
+ @BeforeEach
public void setUp() throws Exception {
- super.setUp();
- MCRConfiguration2.set("MCR.datadir", folder.newFolder("data").getAbsolutePath());
-
MCRSession session = MCRSessionMgr.getCurrentSession();
session.setCurrentIP("127.0.0.1");
session.setUserInformation(MCRSystemUserInformation.SUPER_USER);
@@ -128,7 +121,7 @@ public void testSlotTransform() throws IOException, ParseException {
cal.add(Calendar.DAY_OF_MONTH, 7);
slot.addWarningDate(cal.getTime());
- assertEquals(1, slot.getWarningDates().get(1).compareTo(slot.getWarningDates().get(0)));
+ Assertions.assertEquals(1, slot.getWarningDates().get(1).compareTo(slot.getWarningDates().get(0)));
Lecturer lecturer = new Lecturer();
lecturer.setName("Mustermann, Max");
@@ -146,7 +139,7 @@ public void testSlotTransform() throws IOException, ParseException {
slot.addEntry(slotEntry);
- assertEquals(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "3400.01.01"), slot.getLocation());
+ Assertions.assertEquals(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "3400.01.01"), slot.getLocation());
Document xml = new EntityFactory<>(slot).toDocument();
@@ -154,8 +147,8 @@ public void testSlotTransform() throws IOException, ParseException {
Slot transSlot = new EntityFactory<>(Slot.class).fromElement(xml.getRootElement());
- assertEquals(slot.getReadKey(), transSlot.getReadKey());
- assertEquals(slot.getWriteKey(), transSlot.getWriteKey());
+ Assertions.assertEquals(slot.getReadKey(), transSlot.getReadKey());
+ Assertions.assertEquals(slot.getWriteKey(), transSlot.getWriteKey());
}
@Test
@@ -183,7 +176,7 @@ public void testSlotListTransform() throws IOException, ParseException {
Document xSL = new EntityFactory<>(slotList).toDocument();
new XMLOutputter(Format.getPrettyFormat()).output(xSL, System.out);
- assertNotNull(xSL);
+ Assertions.assertNotNull(xSL);
}
@Test
@@ -218,12 +211,12 @@ public void testActiveSlotListTransform() throws IOException {
SLOT_MANAGER.addSlot(slot2);
- assertEquals(2, SLOT_MANAGER.getSlotList().getSlots().size());
+ Assertions.assertEquals(2, SLOT_MANAGER.getSlotList().getSlots().size());
SlotList activeSlots = SLOT_MANAGER.getSlotList().getActiveSlots();
- assertEquals(1, activeSlots.getSlots().size());
- assertNull(activeSlots.getSlots().getFirst().getEntries());
+ Assertions.assertEquals(1, activeSlots.getSlots().size());
+ Assertions.assertNull(activeSlots.getSlots().getFirst().getEntries());
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(activeSlots).toDocument(), System.out);
}
@@ -238,9 +231,11 @@ public void testGetNextFreeId() throws IOException {
slot2.setStatus(Status.FREE);
SLOT_MANAGER.addSlot(slot2);
- assertEquals(3, SLOT_MANAGER.getNextFreeId(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "3400.01.01")));
+ Assertions.assertEquals(3,
+ SLOT_MANAGER.getNextFreeId(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "3400.01.01")));
- assertEquals(1, SLOT_MANAGER.getNextFreeId(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "0027.01.01")));
+ Assertions.assertEquals(1,
+ SLOT_MANAGER.getNextFreeId(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "0027.01.01")));
}
@Test
@@ -255,8 +250,8 @@ public void testGetSlotById() throws IOException {
Slot found = SLOT_MANAGER.getSlotById("3400.01.01.0001");
- assertNotNull(found);
- assertEquals(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "3400.01.01"), found.getLocation());
+ Assertions.assertNotNull(found);
+ Assertions.assertEquals(new MCRCategoryID(Slot.CLASSIF_ROOT_LOCATION, "3400.01.01"), found.getLocation());
}
@Test
@@ -267,17 +262,17 @@ public void testSaveSlot()
SLOT_MANAGER.saveOrUpdate(slot);
- assertNotNull(slot.getMCRObjectID());
+ Assertions.assertNotNull(slot.getMCRObjectID());
MCRObject obj = MCRMetadataManager.retrieveMCRObject(slot.getMCRObjectID());
- assertNotNull(obj);
+ Assertions.assertNotNull(obj);
Slot ts = SlotWrapper.unwrapMCRObject(obj);
- assertEquals(slot.getSlotId(), ts.getSlotId());
+ Assertions.assertEquals(slot.getSlotId(), ts.getSlotId());
- assertEquals(slot.getEntries().getFirst().getId(), ts.getEntries().getFirst().getId());
+ Assertions.assertEquals(slot.getEntries().getFirst().getId(), ts.getEntries().getFirst().getId());
}
@Test
@@ -288,17 +283,17 @@ public void testSaveSlotWithFileEntry()
SLOT_MANAGER.saveOrUpdate(slot);
- assertNotNull(slot.getMCRObjectID());
+ Assertions.assertNotNull(slot.getMCRObjectID());
MCRObject obj = MCRMetadataManager.retrieveMCRObject(slot.getMCRObjectID());
- assertNotNull(obj);
+ Assertions.assertNotNull(obj);
Slot ts = SlotWrapper.unwrapMCRObject(obj);
- assertEquals(slot.getSlotId(), ts.getSlotId());
+ Assertions.assertEquals(slot.getSlotId(), ts.getSlotId());
- assertEquals(slot.getEntries().getFirst().getId(), ts.getEntries().getFirst().getId());
+ Assertions.assertEquals(slot.getEntries().getFirst().getId(), ts.getEntries().getFirst().getId());
}
@Test
@@ -309,11 +304,11 @@ public void testDeleteSlot()
SLOT_MANAGER.saveOrUpdate(slot);
- startNewTransaction();
+ MCRJPATestHelper.startNewTransaction();
SLOT_MANAGER.delete(slot);
- assertNull(SLOT_MANAGER.getSlotById(slot.getSlotId()));
+ Assertions.assertNull(SLOT_MANAGER.getSlotById(slot.getSlotId()));
}
@Test
@@ -324,11 +319,11 @@ public void testDeleteSlotWithFileEntry()
SLOT_MANAGER.saveOrUpdate(slot);
- startNewTransaction();
+ MCRJPATestHelper.startNewTransaction();
SLOT_MANAGER.delete(slot);
- assertNull(SLOT_MANAGER.getSlotById(slot.getSlotId()));
+ Assertions.assertNull(SLOT_MANAGER.getSlotById(slot.getSlotId()));
}
@Test
@@ -345,14 +340,14 @@ public void testSaveSlotList()
SLOT_MANAGER.addSlot(slot2);
SLOT_MANAGER.saveOrUpdate(slot2);
- assertNotNull(slot1.getMCRObjectID());
- assertNotNull(slot2.getMCRObjectID());
+ Assertions.assertNotNull(slot1.getMCRObjectID());
+ Assertions.assertNotNull(slot2.getMCRObjectID());
SLOT_MANAGER.getSlotList().getSlots().clear();
- assertEquals(0, SLOT_MANAGER.getSlotList().getSlots().size());
+ Assertions.assertEquals(0, SLOT_MANAGER.getSlotList().getSlots().size());
SLOT_MANAGER.loadList();
- assertEquals(2, SLOT_MANAGER.getSlotList().getSlots().size());
+ Assertions.assertEquals(2, SLOT_MANAGER.getSlotList().getSlots().size());
}
@Test
@@ -371,13 +366,14 @@ public void testSlotEntries() {
SlotEntry> entry = slot.getEntryById(slotEntry.getId());
- assertEquals(slotEntry.getId(), entry.getId());
+ Assertions.assertEquals(slotEntry.getId(), entry.getId());
((HeadlineEntry) entry.getEntry()).setText("Neue Überschrift");
slot.setEntry(entry);
- assertEquals("Neue Überschrift", ((HeadlineEntry) slot.getEntryById(slotEntry.getId()).getEntry()).getText());
+ Assertions.assertEquals("Neue Überschrift",
+ ((HeadlineEntry) slot.getEntryById(slotEntry.getId()).getEntry()).getText());
}
@Test
@@ -396,11 +392,11 @@ public void testSlotEntryRemove() {
SlotEntry> entry = slot.getEntryById(slotEntry.getId());
- assertEquals(slotEntry.getId(), entry.getId());
- assertEquals(1, slot.getEntries().size());
+ Assertions.assertEquals(slotEntry.getId(), entry.getId());
+ Assertions.assertEquals(1, slot.getEntries().size());
- assertTrue("slot entry remove", slot.removeEntry(slotEntry));
- assertEquals(0, slot.getEntries().size());
+ Assertions.assertTrue(slot.removeEntry(slotEntry), "slot entry remove");
+ Assertions.assertEquals(0, slot.getEntries().size());
}
private Slot activeSlot() {
diff --git a/src/test/java/de/urmel_dl/dbt/rc/TestSlotEntry.java b/src/test/java/de/urmel_dl/dbt/rc/TestSlotEntry.java
index ae654f4e..68c759c6 100644
--- a/src/test/java/de/urmel_dl/dbt/rc/TestSlotEntry.java
+++ b/src/test/java/de/urmel_dl/dbt/rc/TestSlotEntry.java
@@ -17,17 +17,13 @@
*/
package de.urmel_dl.dbt.rc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mycore.test.MyCoReTest;
import de.urmel_dl.dbt.opc.OPCConnector;
import de.urmel_dl.dbt.rc.datamodel.slot.Slot;
@@ -42,10 +38,11 @@
import de.urmel_dl.dbt.utils.EntityFactory;
/**
- * @author Ren\u00E9 Adler (eagle)
+ * @author René Adler (eagle)
*
*/
-public class TestSlotEntry extends MCRTestCase {
+@MyCoReTest
+public class TestSlotEntry {
private SlotEntry newHeadLineEntry() {
SlotEntry slotEntry = new SlotEntry<>();
@@ -137,7 +134,7 @@ private SlotEntry newFileEntry() throws IOException {
@Test
public void testHeadlineEntry() throws IOException {
SlotEntry slotEntry = newHeadLineEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -145,7 +142,7 @@ public void testHeadlineEntry() throws IOException {
@Test
public void testMCRObjectEntry() throws IOException {
SlotEntry slotEntry = newMCRObjectEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -153,7 +150,7 @@ public void testMCRObjectEntry() throws IOException {
@Test
public void testTextEntryPlain() throws IOException {
SlotEntry slotEntry = newPlainTextEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -161,7 +158,7 @@ public void testTextEntryPlain() throws IOException {
@Test
public void testTextEntryHTML() throws IOException {
SlotEntry slotEntry = newHtmlTextEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -169,7 +166,7 @@ public void testTextEntryHTML() throws IOException {
@Test
public void testWebLinkEntry() throws IOException {
SlotEntry slotEntry = newWebLinkEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -177,7 +174,7 @@ public void testWebLinkEntry() throws IOException {
@Test
public void testOPCRecordEntry() throws Exception {
SlotEntry slotEntry = newOPCRecordEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -185,7 +182,7 @@ public void testOPCRecordEntry() throws Exception {
@Test
public void testFileEntry() throws IOException {
SlotEntry slotEntry = newFileEntry();
- assertNotNull(slotEntry);
+ Assertions.assertNotNull(slotEntry);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(slotEntry).toDocument(), System.out);
}
@@ -202,7 +199,7 @@ public void testAddSlotEntries() throws Exception {
slot.addEntry(newOPCRecordEntry());
slot.addEntry(newFileEntry());
- assertEquals(7, slot.getEntries().size());
+ Assertions.assertEquals(7, slot.getEntries().size());
}
@Test
@@ -217,13 +214,13 @@ public void testInsertSlotEntries() throws IOException {
slot.addEntry(newWebLinkEntry());
- assertNotNull(pText.getId());
- assertEquals(4, slot.getEntries().size());
+ Assertions.assertNotNull(pText.getId());
+ Assertions.assertEquals(4, slot.getEntries().size());
SlotEntry> hText = newHtmlTextEntry();
slot.addEntry(hText, pText.getId());
- assertEquals(5, slot.getEntries().size());
+ Assertions.assertEquals(5, slot.getEntries().size());
int iPT = -1;
int iHT = -1;
@@ -236,16 +233,16 @@ public void testInsertSlotEntries() throws IOException {
}
}
- assertNotEquals(-1, iPT);
- assertNotEquals(-1, iHT);
+ Assertions.assertNotEquals(-1, iPT);
+ Assertions.assertNotEquals(-1, iHT);
- assertTrue(iPT < iHT);
+ Assertions.assertTrue(iPT < iHT);
}
@Test
public void testSlotEntryTypes() throws IOException {
SlotEntryTypes entryTypes = SlotEntryTypes.instance();
- assertNotNull(entryTypes);
+ Assertions.assertNotNull(entryTypes);
new XMLOutputter(Format.getPrettyFormat()).output(new EntityFactory<>(entryTypes).toDocument(), System.out);
}
diff --git a/src/test/java/de/urmel_dl/dbt/test/JerseyTestCase.java b/src/test/java/de/urmel_dl/dbt/test/JerseyTestCase.java
index 7e741425..20cf2ddc 100644
--- a/src/test/java/de/urmel_dl/dbt/test/JerseyTestCase.java
+++ b/src/test/java/de/urmel_dl/dbt/test/JerseyTestCase.java
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.Collections;
@@ -31,56 +30,27 @@
import java.util.stream.Collectors;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mycore.common.config.MCRComponent;
import org.mycore.common.config.MCRConfigurationBase;
import org.mycore.common.config.MCRConfigurationLoader;
import org.mycore.common.config.MCRConfigurationLoaderFactory;
import org.mycore.common.config.MCRRuntimeComponentDetector;
-import org.mycore.datamodel.niofs.utils.MCRRecursiveDeleter;
+import org.mycore.test.MCRMetadataExtension;
+import org.mycore.test.MyCoReTest;
/**
* @author René Adler (eagle)
*
*/
+@MyCoReTest
+@ExtendWith(MCRMetadataExtension.class)
public class JerseyTestCase extends JerseyTest {
- @ClassRule
- public static TemporaryFolder junitFolder = new TemporaryFolder();
-
protected File properties = null;
- @BeforeClass
- public static void initBaseDir() throws IOException {
- if (System.getProperties().getProperty("MCR.Home") == null) {
- File baseDir = junitFolder.newFolder("mcrhome");
- System.out.println("Setting MCR.Home=" + baseDir.getAbsolutePath());
- System.getProperties().setProperty("MCR.Home", baseDir.getAbsolutePath());
- }
- if (System.getProperties().getProperty("MCR.AppName") == null) {
- String currentComponentName = getCurrentComponentName();
- System.out.println("Setting MCR.AppName=" + currentComponentName);
- System.getProperties().setProperty("MCR.AppName", getCurrentComponentName());
- }
- File configDir = new File(System.getProperties().getProperty("MCR.Home"),
- System.getProperties().getProperty("MCR.AppName"));
- System.out.println("Creating config directory: " + configDir);
- configDir.mkdirs();
- }
-
- @AfterClass
- public static void clearBaseDir() throws IOException {
- File configDir = new File(System.getProperties().getProperty("MCR.Home"),
- System.getProperties().getProperty("MCR.AppName"));
- //delete configDir recursively
- Files.walkFileTree(configDir.toPath(), new MCRRecursiveDeleter());
- }
-
/**
* initializes MCRConfiguration with an empty property file. This can be used to test MyCoRe classes without any
* propties set, using default. You may want to set Properties per TestCase with the set() method of
@@ -89,7 +59,7 @@ public static void clearBaseDir() throws IOException {
* @see org.mycore.common.config.MCRConfiguration2#set(String, String)
*/
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
initProperties();
@@ -111,7 +81,7 @@ public void setUp() throws Exception {
}
@Override
- @After
+ @AfterEach
public void tearDown() throws Exception {
if (properties != null) {
properties.delete();
diff --git a/src/test/java/de/urmel_dl/dbt/utils/TestEntityFactory.java b/src/test/java/de/urmel_dl/dbt/utils/TestEntityFactory.java
index ce1e56cd..21e9d2d2 100644
--- a/src/test/java/de/urmel_dl/dbt/utils/TestEntityFactory.java
+++ b/src/test/java/de/urmel_dl/dbt/utils/TestEntityFactory.java
@@ -18,51 +18,38 @@
*/
package de.urmel_dl.dbt.utils;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mycore.common.MCRTestConfiguration;
+import org.mycore.common.MCRTestProperty;
+import org.mycore.common.config.MCRConfiguration2;
+import org.mycore.test.MyCoReTest;
+
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlValue;
-import org.junit.Before;
-import org.junit.Test;
-import org.mycore.common.MCRTestCase;
-import org.mycore.common.config.MCRConfiguration2;
-
/**
- * @author Ren\u00E9 Adler (eagle)
+ * @author René Adler (eagle)
*
*/
-public class TestEntityFactory extends MCRTestCase {
-
- /* (non-Javadoc)
- * @see org.mycore.common.MCRTestCase#setUp()
- */
- @Before
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected Map getTestProperties() {
- final Map testProperties = super.getTestProperties();
- testProperties.put(
- EntityFactory.CONFIG_PREFIX + TestEntity.class.getPackage().getName() + "."
- + EntityFactory.CONFIG_MARSHALLER
- + "eclipselink.json.include-root",
- "false");
- return testProperties;
+@MyCoReTest
+@MCRTestConfiguration(
+ properties = {
+ @MCRTestProperty(key = EntityFactory.CONFIG_PREFIX + "de.urmel_dl.dbt.utils."
+ + EntityFactory.CONFIG_MARSHALLER
+ + "eclipselink.json.include-root", string = "false")
}
+)
+public class TestEntityFactory {
@Test
public void testProperties() {
EntityFactory ef = new EntityFactory<>(testEntity());
Map props = ef.properties(EntityFactory.CONFIG_MARSHALLER);
- assertFalse((Boolean) props.get("eclipselink.json.include-root"));
+ Assertions.assertFalse((Boolean) props.get("eclipselink.json.include-root"));
}
@Test
@@ -76,7 +63,7 @@ public void testPropertiesClass() {
EntityFactory ef = new EntityFactory<>(testEntity());
Map props = ef.properties(EntityFactory.CONFIG_MARSHALLER);
- assertTrue((Boolean) props.get("eclipselink.json.include-root"));
+ Assertions.assertTrue((Boolean) props.get("eclipselink.json.include-root"));
}
private TestEntity testEntity() {