Skip to content

Commit f3f4316

Browse files
committed
SNAPSHOT bump
JUnit bumped to v5
1 parent fc32651 commit f3f4316

4 files changed

Lines changed: 47 additions & 38 deletions

File tree

pom.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.atomgraph</groupId>
55
<artifactId>linkeddatahub</artifactId>
6-
<version>5.3.1-SNAPSHOT</version>
6+
<version>5.4.0-SNAPSHOT</version>
77
<packaging>${packaging.type}</packaging>
88

99
<name>AtomGraph LinkedDataHub</name>
@@ -187,9 +187,9 @@
187187
<type>jar</type>
188188
</dependency>
189189
<dependency>
190-
<groupId>junit</groupId>
191-
<artifactId>junit</artifactId>
192-
<version>4.13.2</version>
190+
<groupId>org.junit.jupiter</groupId>
191+
<artifactId>junit-jupiter</artifactId>
192+
<version>5.11.4</version>
193193
<scope>test</scope>
194194
</dependency>
195195
</dependencies>
@@ -220,6 +220,11 @@
220220
</pluginManagement>
221221

222222
<plugins>
223+
<plugin>
224+
<groupId>org.apache.maven.plugins</groupId>
225+
<artifactId>maven-surefire-plugin</artifactId>
226+
<version>3.5.2</version>
227+
</plugin>
223228
<plugin>
224229
<groupId>org.apache.maven.plugins</groupId>
225230
<artifactId>maven-release-plugin</artifactId>

src/test/java/com/atomgraph/core/io/BillionLaughsTest.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import org.apache.jena.rdf.model.*;
44
import org.apache.jena.riot.*;
55
import org.apache.jena.riot.system.ErrorHandlerFactory;
6-
import org.junit.Test;
6+
import org.junit.jupiter.api.Test;
77

88
import java.io.ByteArrayInputStream;
99
import java.nio.charset.StandardCharsets;
1010
import org.apache.jena.riot.system.StreamRDFLib;
11+
import static org.junit.jupiter.api.Assertions.assertThrows;
1112

1213
public class BillionLaughsTest {
1314

@@ -33,22 +34,24 @@ public class BillionLaughsTest {
3334
</rdf:RDF>
3435
""";
3536

36-
@Test(expected = RiotException.class)
37+
@Test
3738
public void testBillionLaughs() {
38-
Model m = ModelFactory.createDefaultModel();
39-
40-
ByteArrayInputStream bais = new ByteArrayInputStream(MALICIOUS.getBytes(StandardCharsets.UTF_8));
41-
42-
RDFParser parser = RDFParser.create()
43-
.lang(Lang.RDFXML)
44-
.errorHandler(ErrorHandlerFactory.errorHandlerStrict)
45-
.checking(true)
46-
.base("http://example.org/")
47-
.source(bais)
48-
.build();
49-
50-
System.out.println("Starting parse...");
51-
parser.parse(StreamRDFLib.graph(m.getGraph()));
52-
System.out.println("Model size: " + m.size());
39+
assertThrows(RiotException.class, () -> {
40+
Model m = ModelFactory.createDefaultModel();
41+
42+
ByteArrayInputStream bais = new ByteArrayInputStream(MALICIOUS.getBytes(StandardCharsets.UTF_8));
43+
44+
RDFParser parser = RDFParser.create()
45+
.lang(Lang.RDFXML)
46+
.errorHandler(ErrorHandlerFactory.errorHandlerStrict)
47+
.checking(true)
48+
.base("http://example.org/")
49+
.source(bais)
50+
.build();
51+
52+
System.out.println("Starting parse...");
53+
parser.parse(StreamRDFLib.graph(m.getGraph()));
54+
System.out.println("Model size: " + m.size());
55+
});
5356
}
5457
}

src/test/java/com/atomgraph/linkeddatahub/server/util/URLValidatorTest.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
package com.atomgraph.linkeddatahub.server.util;
1717

1818
import com.atomgraph.linkeddatahub.server.exception.InternalURLException;
19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import java.net.URI;
22+
import static org.junit.jupiter.api.Assertions.assertThrows;
2223

2324
/**
2425
* Unit tests for URLValidator SSRF protection.
@@ -32,34 +33,34 @@
3233
public class URLValidatorTest
3334
{
3435

35-
@Test(expected = IllegalArgumentException.class)
36+
@Test
3637
public void testNullURI()
3738
{
38-
new URLValidator(false).validate(null);
39+
assertThrows(IllegalArgumentException.class, () -> new URLValidator(false).validate(null));
3940
}
4041

41-
@Test(expected = InternalURLException.class)
42+
@Test
4243
public void testLinkLocalIPv4Blocked()
4344
{
44-
new URLValidator(false).validate(URI.create("http://169.254.1.1:8080/test"));
45+
assertThrows(InternalURLException.class, () -> new URLValidator(false).validate(URI.create("http://169.254.1.1:8080/test")));
4546
}
4647

47-
@Test(expected = InternalURLException.class)
48+
@Test
4849
public void testPrivateClass10Blocked()
4950
{
50-
new URLValidator(false).validate(URI.create("http://10.0.0.1:8080/test"));
51+
assertThrows(InternalURLException.class, () -> new URLValidator(false).validate(URI.create("http://10.0.0.1:8080/test")));
5152
}
5253

53-
@Test(expected = InternalURLException.class)
54+
@Test
5455
public void testPrivateClass172Blocked()
5556
{
56-
new URLValidator(false).validate(URI.create("http://172.16.0.0:8080/test"));
57+
assertThrows(InternalURLException.class, () -> new URLValidator(false).validate(URI.create("http://172.16.0.0:8080/test")));
5758
}
5859

59-
@Test(expected = InternalURLException.class)
60+
@Test
6061
public void testPrivateClass192Blocked()
6162
{
62-
new URLValidator(false).validate(URI.create("http://192.168.1.1:8080/test"));
63+
assertThrows(InternalURLException.class, () -> new URLValidator(false).validate(URI.create("http://192.168.1.1:8080/test")));
6364
}
6465

6566
@Test

src/test/java/com/atomgraph/linkeddatahub/writer/function/ConstructTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import org.apache.jena.rdf.model.Model;
2727
import org.apache.jena.rdf.model.ModelFactory;
2828
import org.apache.jena.vocabulary.RDF;
29-
import org.junit.Before;
30-
import org.junit.Test;
31-
import static org.junit.Assert.*;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
31+
import static org.junit.jupiter.api.Assertions.*;
3232

3333
/**
3434
* Unit tests for the {@link Construct} Saxon extension function.
@@ -48,7 +48,7 @@ public class ConstructTest
4848
private Processor processor;
4949
private Construct construct;
5050

51-
@Before
51+
@BeforeEach
5252
public void setUp()
5353
{
5454
processor = new Processor(false);
@@ -108,10 +108,10 @@ public void testEmptyMap() throws Exception
108108
assertTrue(model.isEmpty());
109109
}
110110

111-
@Test(expected = QueryParseException.class)
111+
@Test
112112
public void testInvalidSparql() throws Exception
113113
{
114-
construct.call(new XdmValue[] { buildMap(CLASS_URI, "NOT VALID SPARQL") });
114+
assertThrows(QueryParseException.class, () -> construct.call(new XdmValue[] { buildMap(CLASS_URI, "NOT VALID SPARQL") }));
115115
}
116116

117117
}

0 commit comments

Comments
 (0)