Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,6 @@
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
Expand Down Expand Up @@ -635,8 +631,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
Comment on lines 633 to 636

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add JUnit Jupiter engine so tests actually run

This POM now only declares junit-jupiter-api, which is compile-time only; without junit-jupiter-engine (or another JUnit 5 provider configured elsewhere), Maven Surefire won’t discover/run any JUnit 5 tests. I couldn’t find any junit-jupiter-engine/junit-platform dependency in this repo, so CI can start “passing” while silently skipping tests unless the parent POM supplies the engine.

Useful? React with 👍 / 👎.

</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -59,7 +59,7 @@ protected Application configure() {
}

@Override
@Before()
@BeforeEach
public void setUp() throws Exception {
super.setUp();

Expand Down
26 changes: 13 additions & 13 deletions src/test/java/de/urmel_dl/dbt/opc/TestOPCConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";

Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
}
Expand All @@ -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"));
}
}
30 changes: 15 additions & 15 deletions src/test/java/de/urmel_dl/dbt/opc/TestOPCResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -41,67 +41,67 @@ 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);
}

@Test
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);
}

@Test
public void testRecordBasicCopy() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve(
"opc:url=" + OPC_URL + "&db=" + OPC_DB + "&record=785761829&copys=false");
assertNotNull(xml);
Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}

@Test
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);
}

@Test
public void testBarcodeBasicCopy() throws IOException {
Element xml = MCRURIResolver.obtainInstance().resolve(
"opc:url=" + OPC_URL + "&db=" + OPC_DB + "&barcode=ILM1$005419999&copys=false");
assertNotNull(xml);
Assertions.assertNotNull(xml);
new XMLOutputter(Format.getPrettyFormat()).output(xml, System.out);
}

Expand All @@ -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);
}
}
43 changes: 23 additions & 20 deletions src/test/java/de/urmel_dl/dbt/opc/TestOPCResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -51,9 +51,14 @@
import jakarta.ws.rs.core.Response;

/**
* @author Ren\u00E9 Adler (eagle)
* @author René Adler (eagle)
*
*/
@MCRTestConfiguration(
properties = {
@MCRTestProperty(key="DBT.OPCResource.Marshaller.eclipselink.json.include-root", string="true")
}
)
public class TestOPCResource extends JerseyTestCase {

private WebTarget webResource;
Expand All @@ -63,22 +68,20 @@ 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();
}

@Test
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);
});
}

Expand All @@ -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);
});
});
}
Expand All @@ -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);
});
});
});
Expand All @@ -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());
});
});
}
Expand All @@ -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());
});
});
}
Expand All @@ -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);
});
});
}
Expand All @@ -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();
Expand Down
Loading