diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java index c4e48dd4df2..5322b7a6935 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.datatypes; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.base.CoreDatatype; @@ -260,15 +260,15 @@ public void testParseFloat() { public void testCompareDateTimeStamp() { int sameOffset = XMLDatatypeUtil.compare("2019-12-06T00:00:00Z", "2019-12-06T00:00:00+00:00", XSD.DATETIMESTAMP); - assertTrue("Not the same", sameOffset == 0); + assertTrue(sameOffset == 0, "Not the same"); int offset1 = XMLDatatypeUtil.compare("2019-12-06T14:00:00+02:00", "2019-12-06T13:00:00+02:00", XSD.DATETIMESTAMP); - assertTrue("Wrong order", offset1 > 0); + assertTrue(offset1 > 0, "Wrong order"); int offset2 = XMLDatatypeUtil.compare("2019-12-06T12:00:00+02:00", "2019-12-06T13:00:00-04:00", XSD.DATETIMESTAMP); - assertTrue("Wrong order", offset2 < 0); + assertTrue(offset2 < 0, "Wrong order"); } @Test diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java index d674859ec47..7ab45abd033 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.impl; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.HashSet; import java.util.Set; diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java index f5eee9f2f95..6977aa495d3 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.impl.LinkedHashModel; diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java index dab6b7a2fbb..18a32c8d2e6 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.HashSet; import java.util.Set; @@ -41,12 +41,12 @@ public void setUp() throws Exception { @Test public void testCollector() { Model m = stmts.stream().collect(ModelCollector.toModel()); - assertEquals("Number of statements does not match", m.size(), nrStmts); + assertEquals(m.size(), nrStmts, "Number of statements does not match"); } @Test public void testCollectorParallel() { Model m = stmts.parallelStream().collect(ModelCollector.toModel()); - assertEquals("Number of statements does not match", m.size(), nrStmts); + assertEquals(m.size(), nrStmts, "Number of statements does not match"); } } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java index 0e48d4daa87..a8812134055 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java @@ -11,10 +11,10 @@ package org.eclipse.rdf4j.model.util; import static org.assertj.core.api.Assertions.assertThat; -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 static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import java.util.Optional; @@ -81,7 +81,7 @@ public void testModelsIsomorphic() { // add same statement again model2.add(foo, RDF.TYPE, bar); - assertTrue("Duplicate statement should not be considered", Models.isomorphic(model1, model2)); + assertTrue(Models.isomorphic(model1, model2), "Duplicate statement should not be considered"); // two identical statements with bnodes added. model1.add(foo, RDF.TYPE, VF.createBNode()); @@ -461,22 +461,22 @@ public void testConvertReificationToRDFStar() { Model referenceRDFStarModel = RDFStarTestHelper.createRDFStarModel(); Model rdfStarModel1 = Models.convertReificationToRDFStar(VF, reificationModel); - assertTrue("RDF reification conversion to RDF-star with explicit VF, model-to-model", - Models.isomorphic(rdfStarModel1, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel1, referenceRDFStarModel), + "RDF reification conversion to RDF-star with explicit VF, model-to-model"); Model rdfStarModel2 = Models.convertReificationToRDFStar(reificationModel); - assertTrue("RDF reification conversion to RDF-star with implicit VF, model-to-model", - Models.isomorphic(rdfStarModel2, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel2, referenceRDFStarModel), + "RDF reification conversion to RDF-star with implicit VF, model-to-model"); Model rdfStarModel3 = new TreeModel(); Models.convertReificationToRDFStar(VF, reificationModel, (Consumer) rdfStarModel3::add); - assertTrue("RDF reification conversion to RDF-star with explicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel3, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel3, referenceRDFStarModel), + "RDF reification conversion to RDF-star with explicit VF, model-to-consumer"); Model rdfStarModel4 = new TreeModel(); Models.convertReificationToRDFStar(reificationModel, rdfStarModel4::add); - assertTrue("RDF reification conversion to RDF-star with implicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel4, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel4, referenceRDFStarModel), + "RDF reification conversion to RDF-star with implicit VF, model-to-consumer"); } @Test @@ -486,22 +486,22 @@ public void testConvertIncompleteReificationToRDFStar() { Model incompleteReificationModel = RDFStarTestHelper.createIncompleteRDFReificationModel(); Model rdfStarModel1 = Models.convertReificationToRDFStar(VF, incompleteReificationModel); - assertTrue("Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-model", - Models.isomorphic(rdfStarModel1, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel1, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-model"); Model rdfStarModel2 = Models.convertReificationToRDFStar(incompleteReificationModel); - assertTrue("Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-model", - Models.isomorphic(rdfStarModel2, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel2, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-model"); Model rdfStarModel3 = new TreeModel(); Models.convertReificationToRDFStar(VF, incompleteReificationModel, (Consumer) rdfStarModel3::add); - assertTrue("Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel3, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel3, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-consumer"); Model rdfStarModel4 = new TreeModel(); Models.convertReificationToRDFStar(incompleteReificationModel, rdfStarModel4::add); - assertTrue("Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel4, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel4, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-consumer"); } @Test @@ -510,22 +510,22 @@ public void testConvertRDFStarToReification() { Model referenceModel = RDFStarTestHelper.createRDFReificationModel(); Model reificationModel1 = Models.convertRDFStarToReification(VF, rdfStarModel); - assertTrue("RDF-star conversion to reification with explicit VF, model-to-model", - Models.isomorphic(reificationModel1, referenceModel)); + assertTrue(Models.isomorphic(reificationModel1, referenceModel), + "RDF-star conversion to reification with explicit VF, model-to-model"); Model reificationModel2 = Models.convertRDFStarToReification(rdfStarModel); - assertTrue("RDF-star conversion to reification with implicit VF, model-to-model", - Models.isomorphic(reificationModel2, referenceModel)); + assertTrue(Models.isomorphic(reificationModel2, referenceModel), + "RDF-star conversion to reification with implicit VF, model-to-model"); Model reificationModel3 = new TreeModel(); Models.convertRDFStarToReification(VF, rdfStarModel, (Consumer) reificationModel3::add); - assertTrue("RDF-star conversion to reification with explicit VF, model-to-consumer", - Models.isomorphic(reificationModel3, referenceModel)); + assertTrue(Models.isomorphic(reificationModel3, referenceModel), + "RDF-star conversion to reification with explicit VF, model-to-consumer"); Model reificationModel4 = new TreeModel(); Models.convertRDFStarToReification(rdfStarModel, reificationModel4::add); - assertTrue("RDF-star conversion to reification with explicit VF, model-to-consumer", - Models.isomorphic(reificationModel4, referenceModel)); + assertTrue(Models.isomorphic(reificationModel4, referenceModel), + "RDF-star conversion to reification with explicit VF, model-to-consumer"); } } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java index 5dc2fcb40cc..3e95d627b1f 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Collections; @@ -269,7 +269,7 @@ public final void testWrapPut() throws Exception { Map testMap = Namespaces.wrap(testSet); String put1 = testMap.put(testPrefix1, testName1); - assertNull("Should have returned null from put on an empty backing set", put1); + assertNull(put1, "Should have returned null from put on an empty backing set"); assertEquals(1, testSet.size()); assertTrue(testSet.contains(new SimpleNamespace(testPrefix1, testName1))); assertTrue(testMap.containsKey(testPrefix1)); @@ -293,7 +293,7 @@ public final void testWrapPut() throws Exception { assertFalse(testMap.containsValue(testName2)); String put3 = testMap.put(testPrefix1, testName1); - assertNull("Should have returned null from put on an empty backing set", put3); + assertNull(put3, "Should have returned null from put on an empty backing set"); assertEquals(1, testSet.size()); assertTrue(testSet.contains(new SimpleNamespace(testPrefix1, testName1))); assertTrue(testMap.containsKey(testPrefix1)); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java index 8dc4bd940f0..316798af314 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java @@ -10,10 +10,10 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.CALLS_REAL_METHODS; import static org.mockito.Mockito.atLeastOnce; diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java index b3db876c6b0..81edfe27dfe 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java @@ -11,9 +11,9 @@ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.CALLS_REAL_METHODS; import static org.mockito.Mockito.atLeastOnce; diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java index 53281bd9aab..8b83e70545d 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java @@ -12,10 +12,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; @@ -92,19 +92,19 @@ public void testRDFStarReification() { Model convertedModel1 = new LinkedHashModel(); rdfStarModel.forEach((s) -> Statements.convertRDFStarToReification(s, convertedModel1::add)); - assertTrue("RDF-star conversion to reification with implicit VF", - Models.isomorphic(reifiedModel, convertedModel1)); + assertTrue(Models.isomorphic(reifiedModel, convertedModel1), + "RDF-star conversion to reification with implicit VF"); Model convertedModel2 = new LinkedHashModel(); rdfStarModel.forEach((s) -> Statements.convertRDFStarToReification(vf, s, convertedModel2::add)); - assertTrue("RDF-star conversion to reification with explicit VF", - Models.isomorphic(reifiedModel, convertedModel2)); + assertTrue(Models.isomorphic(reifiedModel, convertedModel2), + "RDF-star conversion to reification with explicit VF"); Model convertedModel3 = new LinkedHashModel(); rdfStarModel.forEach((s) -> Statements.convertRDFStarToReification(vf, (t) -> vf.createBNode(t.stringValue()), s, convertedModel3::add)); - assertTrue("RDF-star conversion to reification with explicit VF and custom BNode mapping", - Models.isomorphic(reifiedModel, convertedModel3)); + assertTrue(Models.isomorphic(reifiedModel, convertedModel3), + "RDF-star conversion to reification with explicit VF and custom BNode mapping"); } @Test @@ -113,8 +113,8 @@ public void testTripleToResourceMapper() { vf.createLiteral("data")); Triple t2 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), vf.createLiteral("data")); - assertEquals("Identical triples must produce the same blank node", - Statements.TRIPLE_BNODE_MAPPER.apply(t1), Statements.TRIPLE_BNODE_MAPPER.apply(t2)); + assertEquals(Statements.TRIPLE_BNODE_MAPPER.apply(t1), Statements.TRIPLE_BNODE_MAPPER.apply(t2), + "Identical triples must produce the same blank node"); } @Test diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java index f4c0c25507c..e4f9c620c75 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; @@ -48,35 +48,35 @@ public void testIsCorrectURISplit() throws Exception { @Test public void testIsValidURIReference() throws Exception { assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar/")); - assertTrue("whitespace should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar with a lot of space/")); - assertTrue("unwise chars should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar/unwise{}")); - assertTrue("query params in single quotes should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar?query='blah'")); - assertTrue("query params in double quotes should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar?query=\"blah\"&foo=bar")); - assertTrue("short simple urns should be allowed", URIUtil.isValidURIReference("urn:p1")); - assertTrue("Escaped special char should be allowed", - URIUtil.isValidURIReference("http://example.org/foo\\u00ea/bar/")); - assertTrue("fragment identifier should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar#fragment1")); - assertTrue("Unescaped special char should be allowed", - URIUtil.isValidURIReference("http://example.org/foo®/bar/")); - assertFalse("control char should not be allowed", - URIUtil.isValidURIReference("http://example.org/foo\u0001/bar/")); - assertFalse("relative uri should fail", URIUtil.isValidURIReference("foo/bar/")); - assertFalse("single column is not a valid uri", URIUtil.isValidURIReference(":")); - assertTrue("reserved char is allowed in non-conflicting spot", - URIUtil.isValidURIReference("http://foo.com/b!ar/")); - assertFalse("reserved char should not be allowed in conflicting spot", - URIUtil.isValidURIReference("http;://foo.com/bar/")); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar with a lot of space/"), + "whitespace should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar/unwise{}"), + "unwise chars should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar?query='blah'"), + "query params in single quotes should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar?query=\"blah\"&foo=bar"), + "query params in double quotes should be allowed"); + assertTrue(URIUtil.isValidURIReference("urn:p1"), "short simple urns should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo\\u00ea/bar/"), + "Escaped special char should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar#fragment1"), + "fragment identifier should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo®/bar/"), + "Unescaped special char should be allowed"); + assertFalse(URIUtil.isValidURIReference("http://example.org/foo\u0001/bar/"), + "control char should not be allowed"); + assertFalse(URIUtil.isValidURIReference("foo/bar/"), "relative uri should fail"); + assertFalse(URIUtil.isValidURIReference(":"), "single column is not a valid uri"); + assertTrue(URIUtil.isValidURIReference("http://foo.com/b!ar/"), + "reserved char is allowed in non-conflicting spot"); + assertFalse(URIUtil.isValidURIReference("http;://foo.com/bar/"), + "reserved char should not be allowed in conflicting spot"); } @Test public void controlCharacterInURI() { - assertFalse("URI containing Unicode control char should be invalid", - URIUtil.isValidURIReference("http://example.org/foo\u001F/bar/")); + assertFalse(URIUtil.isValidURIReference("http://example.org/foo\u001F/bar/"), + "URI containing Unicode control char should be invalid"); } @Test diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java index 0914743a420..d33e4530acf 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java @@ -17,8 +17,8 @@ import static org.eclipse.rdf4j.model.util.Values.literal; import static org.eclipse.rdf4j.model.util.Values.namespace; import static org.eclipse.rdf4j.model.util.Values.triple; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java index 42bd44cadee..fefd2f73983 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java @@ -11,7 +11,7 @@ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import java.util.HashSet; diff --git a/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java b/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java index a584851738c..e3e650b9f83 100644 --- a/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java +++ b/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java @@ -11,7 +11,7 @@ package org.eclipse.rdf4j.repository.sail.config; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import java.io.IOException; diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java index 7d3a3da9b4a..8a44f1b4a6b 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.concurrent.TimeUnit; diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java index c34caa3779c..93b27214790 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; import java.net.UnknownHostException; diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java index 751e166caf2..df404d9ef43 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.rdf4j.common.transaction.IsolationLevels; import org.eclipse.rdf4j.model.vocabulary.RDFS; @@ -54,7 +54,7 @@ public void testAddLargeDataset() { long size = connection.size(); System.out.println(size); - assertEquals("Since transaction failed there should be no statements in the store", 0, size); + assertEquals(0, size, "Since transaction failed there should be no statements in the store"); } @@ -119,7 +119,7 @@ public void testRemoveLargeDataset() { long size = connection.size(); System.out.println(size); - assertEquals("Since transaction failed there should be no statements in the store", count, size); + assertEquals(count, size, "Since transaction failed there should be no statements in the store"); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java index 58df65f134f..44d1315e89d 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java @@ -11,9 +11,9 @@ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; diff --git a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java index 3a954953df7..bbf8a329163 100644 --- a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java +++ b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.inferencer.fc; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.rdf4j.common.iteration.CloseableIteration; import org.eclipse.rdf4j.model.BNode; @@ -65,7 +65,7 @@ public void testInferrecContextNoNull() { RDF.TYPE, RDFS.RESOURCE, true)) { while (statements.hasNext()) { Statement next = statements.next(); - assertEquals("Context should be equal", context, next.getContext()); + assertEquals(context, next.getContext(), "Context should be equal"); } } } @@ -76,8 +76,8 @@ public void testInferrecContextNoNull() { public void testDefaultBehaviour() { SchemaCachingRDFSInferencer sail = new SchemaCachingRDFSInferencer(new MemoryStore()); - assertFalse("Current default behaviour should be to add all statements to default context", - sail.isAddInferredStatementsToDefaultContext()); + assertFalse(sail.isAddInferredStatementsToDefaultContext(), + "Current default behaviour should be to add all statements to default context"); } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java index 9af0da5a956..fa1c67f1308 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.io.FileInputStream; diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java index 444796eb978..ff9ab6998c8 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java @@ -15,12 +15,12 @@ import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory; import org.eclipse.rdf4j.sail.lmdb.config.LmdbStoreFactory; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; public class LmdbOptimisticIsolationTest extends OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { setRepositoryFactory(new SailRepositoryFactory() { @Override @@ -30,7 +30,7 @@ public RepositoryImplConfig getConfig() { }); } - @AfterClass + @AfterAll public static void tearDown() throws Exception { setRepositoryFactory(null); } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java index 5365fb38693..731b4a6a791 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; @@ -72,9 +72,9 @@ public void testRemoveValidContext() { conn.remove((IRI) null, null, null, CTX_1); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertFalse("Statement 1 still not removed", conn.hasStatement(S1, false, CTX_1)); - assertTrue("Statement 2 incorrectly removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertFalse(conn.hasStatement(S1, false, CTX_1), "Statement 1 still not removed"); + assertTrue(conn.hasStatement(S2, false, CTX_2), "Statement 2 incorrectly removed"); } } @@ -84,9 +84,9 @@ public void testRemoveEmptyContext() { conn.remove((IRI) null, null, null, (Resource) null); } try (RepositoryConnection conn = repo.getConnection()) { - assertFalse("Statement 0 still not removed", conn.hasStatement(S0, false)); - assertTrue("Statement 1 incorrectly removed", conn.hasStatement(S1, false, CTX_1)); - assertTrue("Statement 2 incorrectly removed", conn.hasStatement(S2, false, CTX_2)); + assertFalse(conn.hasStatement(S0, false), "Statement 0 still not removed"); + assertTrue(conn.hasStatement(S1, false, CTX_1), "Statement 1 incorrectly removed"); + assertTrue(conn.hasStatement(S2, false, CTX_2), "Statement 2 incorrectly removed"); } } @@ -96,9 +96,9 @@ public void testRemoveInvalidContext() { conn.remove((IRI) null, null, null, CTX_INV); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertTrue("Statement 1 incorrectly removed", conn.hasStatement(S1, false, CTX_1)); - assertTrue("Statement 2 incorrectly removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertTrue(conn.hasStatement(S1, false, CTX_1), "Statement 1 incorrectly removed"); + assertTrue(conn.hasStatement(S2, false, CTX_2), "Statement 2 incorrectly removed"); } } @@ -108,9 +108,9 @@ public void testRemoveMultipleValidContext() { conn.remove((IRI) null, null, null, CTX_1, CTX_2); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertFalse("Statement 1 still not removed", conn.hasStatement(S1, false, CTX_1)); - assertFalse("Statement 2 still not removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertFalse(conn.hasStatement(S1, false, CTX_1), "Statement 1 still not removed"); + assertFalse(conn.hasStatement(S2, false, CTX_2), "Statement 2 still not removed"); } } @@ -120,9 +120,9 @@ public void testClearMultipleValidContext() { conn.clear(CTX_1, CTX_2); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertFalse("Statement 1 still not removed", conn.hasStatement(S1, false, CTX_1)); - assertFalse("Statement 2 still not removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertFalse(conn.hasStatement(S1, false, CTX_1), "Statement 1 still not removed"); + assertFalse(conn.hasStatement(S2, false, CTX_2), "Statement 2 still not removed"); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java index f6654782355..57f53f28a92 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.util.List; diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java index 00595b8df51..68f06328ff6 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.io.File; diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java index 30769788436..172867e7ed5 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.File; diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java index 6b283fbfe90..3b72cf4e747 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java @@ -17,9 +17,7 @@ import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.sail.lmdb.config.LmdbStoreConfig; import org.eclipse.rdf4j.testsuite.repository.RepositoryTest; -import org.junit.Rule; import org.junit.jupiter.api.io.TempDir; -import org.junit.rules.TemporaryFolder; public class LmdbStoreRepositoryTest extends RepositoryTest { @TempDir diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java index 90034460bd5..eaf5a99716e 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; @@ -26,10 +26,10 @@ public void testNoTmpDatadir(@TempDir File dataDir) throws IOException { LmdbStore store = new LmdbStore(dataDir); store.init(); - assertTrue("Data dir not set correctly", dataDir.equals(store.getDataDir())); + assertTrue(dataDir.equals(store.getDataDir()), "Data dir not set correctly"); store.shutDown(); - assertTrue("Data dir does not exist anymore", dataDir.exists()); + assertTrue(dataDir.exists(), "Data dir does not exist anymore"); } @Test @@ -37,10 +37,10 @@ public void testTmpDatadir() throws IOException { LmdbStore store = new LmdbStore(); store.init(); File dataDir = store.getDataDir(); - assertTrue("Temp data dir not created", dataDir != null && dataDir.exists()); + assertTrue(dataDir != null && dataDir.exists(), "Temp data dir not created"); store.shutDown(); - assertFalse("Temp data dir still exists", dataDir.exists()); + assertFalse(dataDir.exists(), "Temp data dir still exists"); } @Test @@ -53,7 +53,7 @@ public void testTmpDatadirReinit() throws IOException { store.init(); File dataDir2 = store.getDataDir(); store.shutDown(); - assertFalse("Temp data dirs are the same", dataDir1.equals(dataDir2)); + assertFalse(dataDir1.equals(dataDir2), "Temp data dirs are the same"); } @Test @@ -68,7 +68,7 @@ public void testDatadirMix(@TempDir File dataDir) throws IOException { File tmpDataDir = store.getDataDir(); store.shutDown(); - assertFalse("Temp data dir still exists", tmpDataDir.exists()); - assertTrue("Data dir does not exist anymore", dataDir.exists()); + assertFalse(tmpDataDir.exists(), "Temp data dir still exists"); + assertTrue(dataDir.exists(), "Data dir does not exist anymore"); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java index 9cd9e1063fe..f5b29c440d0 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.io.TempDir; /** * @@ -39,7 +39,8 @@ public class QueryBenchmarkTest { private static SailRepository repository; - public static TemporaryFolder tempDir = new TemporaryFolder(); + @TempDir + public static File file; private static final String query1; private static final String query2; @@ -63,8 +64,6 @@ public class QueryBenchmarkTest { @BeforeAll public static void beforeClass() throws IOException { - tempDir.create(); - File file = tempDir.newFolder(); LmdbStoreConfig config = new LmdbStoreConfig("spoc,ospc,psoc"); repository = new SailRepository(new LmdbStore(file, config)); @@ -86,9 +85,7 @@ private static InputStream getResourceAsStream(String name) { @AfterAll public static void afterClass() throws IOException { - tempDir.delete(); repository.shutDown(); - tempDir = null; repository = null; statementList = null; } @@ -196,5 +193,4 @@ private boolean hasStatement() { return connection.hasStatement(RDF.TYPE, RDF.TYPE, RDF.TYPE, true); } } - } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java index d3b1e3a96a0..2ef14536b13 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java index 1d707ee9a35..e45049a9825 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.io.IOException; @@ -48,21 +48,25 @@ public void testInferredStmts() throws Exception { tripleStore.commit(); try (Txn txn = tripleStore.getTxnManager().createReadTxn()) { - assertEquals("Store should have 1 inferred statement", 1, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, false))); + assertEquals(1, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, false)), + "Store should have 1 inferred statement"); - assertEquals("Store should have 0 explicit statements", 0, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, true))); + assertEquals(0, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, true)), + "Store should have 0 explicit statements"); tripleStore.startTransaction(); tripleStore.storeTriple(1, 2, 3, 1, true); tripleStore.commit(); - assertEquals("Store should have 0 inferred statements", 0, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, false))); + assertEquals(0, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, false)), + "Store should have 0 inferred statements"); - assertEquals("Store should have 1 explicit statements", 1, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, true))); + assertEquals(1, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, true)), + "Store should have 1 explicit statements"); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java index 79cdf1b293d..2d51582153e 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.nio.ByteBuffer; @@ -31,8 +31,8 @@ public void testVarint() { bb.clear(); Varint.writeUnsigned(bb, values[i]); bb.flip(); - assertEquals("Encoding should use " + (i + 1) + " bytes", i + 1, bb.remaining()); - assertEquals("Encoded and decoded value should be equal", values[i], Varint.readUnsigned(bb)); + assertEquals(i + 1, bb.remaining(), "Encoding should use " + (i + 1) + " bytes"); + assertEquals(values[i], Varint.readUnsigned(bb), "Encoded and decoded value should be equal"); } } @@ -47,7 +47,7 @@ public void testVarintList() { bb.flip(); long[] actual = new long[4]; Varint.readListUnsigned(bb, actual); - assertArrayEquals("Encoded and decoded value should be equal", expected, actual); + assertArrayEquals(expected, actual, "Encoded and decoded value should be equal"); } } } diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java index 8397cbe32b3..5c5e0538ec0 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java @@ -11,10 +11,11 @@ package org.eclipse.rdf4j.sail.lucene; import static org.eclipse.rdf4j.model.util.Values.literal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.HashSet; @@ -30,11 +31,10 @@ import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.sail.evaluation.TupleFunctionEvaluationMode; import org.eclipse.rdf4j.sail.memory.MemoryStore; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class MultiParamTest { private static final String NAMESPACE = "http://example.org/"; @@ -63,14 +63,14 @@ private static String joinLines(String... lines) { private static final IRI p2 = iri("p2"); private static final IRI p3 = iri("p3"); - @Rule - public TemporaryFolder tmpFolder = new TemporaryFolder(); + @TempDir + public File tmpFolder; LuceneSail luceneSail; SailRepository repository; SailRepositoryConnection conn; - @Before + @BeforeEach public void setup() throws IOException { MemoryStore memoryStore = new MemoryStore(); // sail with the ex:text1 filter @@ -78,7 +78,7 @@ public void setup() throws IOException { luceneSail.setParameter(LuceneSail.INDEX_CLASS_KEY, LuceneSail.DEFAULT_INDEX_CLASS); luceneSail.setEvaluationMode(TupleFunctionEvaluationMode.NATIVE); luceneSail.setBaseSail(memoryStore); - luceneSail.setDataDir(tmpFolder.newFolder()); + luceneSail.setDataDir(newFolder(tmpFolder, "junit")); repository = new SailRepository(luceneSail); repository.init(); @@ -117,7 +117,7 @@ public void setup() throws IOException { conn.commit(); } - @After + @AfterEach public void complete() { try { conn.close(); @@ -144,9 +144,9 @@ public void testPredicateSimple() { while (result.hasNext()) { Value next = result.next().getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @@ -170,9 +170,9 @@ public void testPredicateMulti() { while (result.hasNext()) { Value next = result.next().getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @@ -196,9 +196,9 @@ public void testMultiPredicate() { while (result.hasNext()) { Value next = result.next().getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @@ -228,9 +228,9 @@ public void testMultiQuery() { while (result.hasNext()) { BindingSet binding = result.next(); Value next = binding.getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @@ -265,9 +265,9 @@ public void testMultiSnippetQuery() { Value snippet1 = bindings.getValue("sp1"); Value snippet2 = bindings.getValue("sp2"); String obj = next + ":" + snippet1 + ":" + snippet2; - assertTrue("unknown value: " + obj, values.remove(obj)); + assertTrue(values.remove(obj), "unknown value: " + obj); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @@ -464,4 +464,13 @@ public void testMultiOrderSnippetQuery() { } } } + + private static File newFolder(File root, String... subDirs) throws IOException { + String subFolder = String.join("/", subDirs); + File result = new File(root, subFolder); + if (!result.mkdirs()) { + throw new IOException("Couldn't create folders " + root); + } + return result; + } } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java index d64744c5d22..e904874ddef 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java @@ -18,7 +18,7 @@ import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.sail.memory.model.MemStatement; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * This test class should be removed when we remove diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java index 0004bd56175..01ec03dc6ec 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java @@ -15,12 +15,12 @@ import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory; import org.eclipse.rdf4j.sail.memory.config.MemoryStoreFactory; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; public class MemoryOptimisticIsolationTest extends OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); setRepositoryFactory(new SailRepositoryFactory() { @@ -31,7 +31,7 @@ public RepositoryImplConfig getConfig() { }); } - @AfterClass + @AfterAll public static void tearDown() throws Exception { setRepositoryFactory(null); System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java index a025bc1fb87..75c86041850 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java @@ -13,17 +13,17 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.testsuite.repository.SparqlAggregatesTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; public class MemorySparqlAggregatesTest extends SparqlAggregatesTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java index f6b1ad7ffe1..df6cfb81f23 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java @@ -12,8 +12,8 @@ package org.eclipse.rdf4j.sail.memory; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java index a3722842e51..c585c44ca43 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java @@ -15,12 +15,12 @@ import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory; import org.eclipse.rdf4j.sail.nativerdf.config.NativeStoreFactory; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; public class NativeOptimisticIsolationTest extends OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { setRepositoryFactory(new SailRepositoryFactory() { @Override @@ -30,7 +30,7 @@ public RepositoryImplConfig getConfig() { }); } - @AfterClass + @AfterAll public static void tearDown() throws Exception { setRepositoryFactory(null); } diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java index d4540a1b386..5abf12b8918 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java @@ -16,9 +16,7 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.testsuite.repository.RepositoryTest; -import org.junit.Rule; import org.junit.jupiter.api.io.TempDir; -import org.junit.rules.TemporaryFolder; public class NativeStoreRepositoryTest extends RepositoryTest { @TempDir diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java index 0906f15fa47..d2c9ebef673 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java @@ -17,7 +17,7 @@ import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.util.Values; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SparqlPathStringTest { diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/OptimisticIsolationTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/OptimisticIsolationTest.java index 65d858849dc..280dd6f13ad 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/OptimisticIsolationTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/OptimisticIsolationTest.java @@ -28,8 +28,8 @@ import org.eclipse.rdf4j.testsuite.repository.optimistic.RemoveIsolationTest; import org.eclipse.rdf4j.testsuite.repository.optimistic.SerializableTest; import org.eclipse.rdf4j.testsuite.repository.optimistic.SnapshotTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @@ -43,12 +43,12 @@ SerializableTest.class }) public abstract class OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeadLockTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeadLockTest.java index 7f9905eea61..dec824742f9 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeadLockTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeadLockTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.concurrent.CountDownLatch; @@ -22,20 +22,20 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DeadLockTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -56,7 +56,7 @@ public static void afterClass() throws Exception { private IRI REMBRANDT; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(DeadLockTest.class); ValueFactory uf = repo.getValueFactory(); @@ -67,7 +67,7 @@ public void setUp() throws Exception { b = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { a.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeleteInsertTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeleteInsertTest.java index 2296daf1298..54fa42eb214 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeleteInsertTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/DeleteInsertTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.rdf4j.common.io.IOUtil; import org.eclipse.rdf4j.common.transaction.IsolationLevel; @@ -19,11 +19,11 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test that a complex delete-insert SPARQL query gets correctly executed. @@ -31,12 +31,12 @@ */ public class DeleteInsertTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -51,13 +51,13 @@ public static void afterClass() throws Exception { private final ClassLoader cl = getClass().getClassLoader(); - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(DeleteInsertTest.class); con = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { con.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/IsolationLevelTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/IsolationLevelTest.java index ebbaaded814..d3f8ced2f08 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/IsolationLevelTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/IsolationLevelTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -31,11 +31,12 @@ import org.eclipse.rdf4j.repository.RepositoryException; import org.eclipse.rdf4j.repository.UnknownTransactionStateException; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,12 +47,12 @@ */ public class IsolationLevelTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -72,13 +73,13 @@ public static void afterClass() throws Exception { * Methods * *---------*/ - @Before + @BeforeEach public void setUp() throws Exception { store = OptimisticIsolationTest.getEmptyInitializedRepository(IsolationLevelTest.class); failed = null; } - @After + @AfterEach public void tearDown() throws Exception { store.shutDown(); } @@ -480,7 +481,7 @@ protected Literal readLiteral(RepositoryConnection con, final IRI subj, final IR } Value obj = stmts.next().getObject(); if (stmts.hasNext()) { - org.junit.Assert.fail("multiple literals: " + obj + " and " + stmts.next()); + Assertions.fail("multiple literals: " + obj + " and " + stmts.next()); } return (Literal) obj; } diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/LinearTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/LinearTest.java index 557d29dfbd4..f0fc25b3d40 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/LinearTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/LinearTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.List; @@ -31,11 +31,11 @@ import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Various tests on linear execution of updates. @@ -43,12 +43,12 @@ */ public class LinearTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -95,7 +95,7 @@ public static void afterClass() throws Exception { private IRI BELSHAZZAR; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(LinearTest.class); lf = repo.getValueFactory(); @@ -119,7 +119,7 @@ public void setUp() throws Exception { b = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { a.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/ModificationTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/ModificationTest.java index 2e2988e8008..fdce342de59 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/ModificationTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/ModificationTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.rdf4j.common.transaction.IsolationLevel; import org.eclipse.rdf4j.common.transaction.IsolationLevels; @@ -22,20 +22,20 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ModificationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -52,7 +52,7 @@ public static void afterClass() throws Exception { private IRI PICASSO; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(ModificationTest.class); ValueFactory uf = repo.getValueFactory(); @@ -61,7 +61,7 @@ public void setUp() throws Exception { con = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { con.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/MonotonicTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/MonotonicTest.java index f34962ff71e..5dbf160fdb8 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/MonotonicTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/MonotonicTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.List; @@ -28,20 +28,20 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MonotonicTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -88,7 +88,7 @@ public static void afterClass() throws Exception { private IRI BELSHAZZAR; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(MonotonicTest.class); lf = repo.getValueFactory(); @@ -112,7 +112,7 @@ public void setUp() throws Exception { b = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { a.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/RemoveIsolationTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/RemoveIsolationTest.java index a9a6196d702..77c2e92e4dd 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/RemoveIsolationTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/RemoveIsolationTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Collections; @@ -23,11 +23,11 @@ import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test isolation behavior on removal operations @@ -37,12 +37,12 @@ */ public class RemoveIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -55,14 +55,14 @@ public static void afterClass() throws Exception { private final IsolationLevel level = IsolationLevels.SNAPSHOT_READ; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(RemoveIsolationTest.class); con = repo.getConnection(); f = con.getValueFactory(); } - @After + @AfterEach public void tearDown() throws Exception { try { con.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SerializableTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SerializableTest.java index cf2748ac918..d558bc1ad8a 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SerializableTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SerializableTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.ArrayList; import java.util.List; @@ -32,11 +32,11 @@ import org.eclipse.rdf4j.repository.RepositoryException; import org.eclipse.rdf4j.sail.SailConflictException; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Tests on behavior of SERIALIZABLE transactions. @@ -46,12 +46,12 @@ */ public class SerializableTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -98,7 +98,7 @@ public static void afterClass() throws Exception { private IRI BELSHAZZAR; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(SerializableTest.class); lf = repo.getValueFactory(); @@ -122,7 +122,7 @@ public void setUp() throws Exception { b = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { a.close(); diff --git a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SnapshotTest.java b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SnapshotTest.java index 4ab5de1dae6..4398553309e 100644 --- a/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SnapshotTest.java +++ b/testsuites/repository/src/main/java/org/eclipse/rdf4j/testsuite/repository/optimistic/SnapshotTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.testsuite.repository.optimistic; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; @@ -31,20 +31,20 @@ import org.eclipse.rdf4j.repository.RepositoryException; import org.eclipse.rdf4j.sail.SailConflictException; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SnapshotTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -91,7 +91,7 @@ public static void afterClass() throws Exception { private IRI BELSHAZZAR; - @Before + @BeforeEach public void setUp() throws Exception { repo = OptimisticIsolationTest.getEmptyInitializedRepository(SnapshotTest.class); lf = repo.getValueFactory(); @@ -115,7 +115,7 @@ public void setUp() throws Exception { b = repo.getConnection(); } - @After + @AfterEach public void tearDown() throws Exception { try { a.close();