You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by ha...@apache.org on 2021/05/11 21:12:01 UTC
[clerezza] 01/01: CLEREZZA-1023: Upgrade to JUnit 5
This is an automated email from the ASF dual-hosted git repository.
hasan pushed a commit to branch CLEREZZA-1023-JUnit5
in repository https://gitbox.apache.org/repos/asf/clerezza.git
commit 2308221ad31942a67954098d3eaf6b7c6248569d
Author: Hasan <ha...@apache.org>
AuthorDate: Tue May 11 23:10:24 2021 +0200
CLEREZZA-1023: Upgrade to JUnit 5
---
api-implementation/pom.xml | 22 ++-
api.utils/pom.xml | 34 ++--
api/pom.xml | 16 +-
dataset/pom.xml | 30 ++-
jaxrs.rdf.providers/pom.xml | 10 +-
ontologies/pom.xml | 8 +-
parent/pom.xml | 16 +-
pom.xml | 4 +-
representation/pom.xml | 24 ++-
sparql/pom.xml | 30 +--
test.utils/pom.xml | 26 +--
.../org/apache/clerezza/test/utils/GraphTest.java | 217 +++++++++++----------
12 files changed, 249 insertions(+), 188 deletions(-)
diff --git a/api-implementation/pom.xml b/api-implementation/pom.xml
index 98e8de5..d4b156b 100644
--- a/api-implementation/pom.xml
+++ b/api-implementation/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -37,11 +37,21 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -60,8 +70,4 @@
</plugin>
</plugins>
</build>
-
- <scm>
- <tag>partial-release-20200202-2</tag>
- </scm>
</project>
diff --git a/api.utils/pom.xml b/api.utils/pom.xml
index 4fb968a..feb6549 100644
--- a/api.utils/pom.xml
+++ b/api.utils/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -33,39 +33,34 @@
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api-implementation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>representation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>dataset</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>ontologies</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>test.utils</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -80,6 +75,21 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<scm>
diff --git a/api/pom.xml b/api/pom.xml
index c504433..56aef20 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -36,8 +36,18 @@
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/dataset/pom.xml b/dataset/pom.xml
index 61193d9..f648b67 100644
--- a/dataset/pom.xml
+++ b/dataset/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -35,22 +35,22 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api-implementation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>sparql</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>test.utils</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -70,16 +70,26 @@
<version>1.2.10</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<scm>
diff --git a/jaxrs.rdf.providers/pom.xml b/jaxrs.rdf.providers/pom.xml
index a475abf..d5d4ae6 100644
--- a/jaxrs.rdf.providers/pom.xml
+++ b/jaxrs.rdf.providers/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -34,22 +34,22 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api-implementation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>representation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api.utils</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
diff --git a/ontologies/pom.xml b/ontologies/pom.xml
index 103c691..de48fa5 100644
--- a/ontologies/pom.xml
+++ b/ontologies/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -35,7 +35,7 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
@@ -53,8 +53,4 @@
</plugin>
</plugins>
</build>
-
- <scm>
- <tag>partial-release-20200202-2</tag>
- </scm>
</project>
diff --git a/parent/pom.xml b/parent/pom.xml
index dce1d01..35b6bb5 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -331,9 +331,19 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>5.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
+ <version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
diff --git a/pom.xml b/pom.xml
index 2a44a7b..1dd75d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,12 +32,12 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>parent/pom.xml</relativePath>
</parent>
<artifactId>clerezza-reactor</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Clerezza - Reactor</name>
<description>
diff --git a/representation/pom.xml b/representation/pom.xml
index 3cbff6a..5a61451 100644
--- a/representation/pom.xml
+++ b/representation/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -35,12 +35,12 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api-implementation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -64,8 +64,18 @@
<artifactId>slf4j-simple</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -96,8 +106,4 @@
</plugin>
</plugins>
</build>
-
- <scm>
- <tag>partial-release-20200220-3</tag>
- </scm>
</project>
diff --git a/sparql/pom.xml b/sparql/pom.xml
index c7b9fb3..4399619 100644
--- a/sparql/pom.xml
+++ b/sparql/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -35,12 +35,12 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api-implementation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -51,11 +51,6 @@
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
@@ -68,6 +63,21 @@
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
<version>1.2.10</version>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -127,8 +137,4 @@
</plugin>
</plugins>
</build>
-
- <scm>
- <tag>partial-release-20200220-3</tag>
- </scm>
</project>
diff --git a/test.utils/pom.xml b/test.utils/pom.xml
index 6af87a5..3639333 100644
--- a/test.utils/pom.xml
+++ b/test.utils/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -33,26 +33,30 @@
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>api-implementation</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apiguardian</groupId>
+ <artifactId>apiguardian-api</artifactId>
+ </dependency>
</dependencies>
-
- <scm>
- <tag>partial-release-20200220-3</tag>
- </scm>
</project>
diff --git a/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java b/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java
index 67f397e..edbb2ca 100644
--- a/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java
+++ b/test.utils/src/main/java/org/apache/clerezza/test/utils/GraphTest.java
@@ -22,8 +22,10 @@ import org.apache.clerezza.*;
import org.apache.clerezza.implementation.TripleImpl;
import org.apache.clerezza.implementation.literal.PlainLiteralImpl;
import org.apache.clerezza.implementation.literal.TypedLiteralImpl;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.platform.runner.JUnitPlatform;
+import org.junit.runner.RunWith;
import java.util.*;
@@ -33,6 +35,7 @@ import java.util.*;
*
* @author reto, szalay, mir, hhn
*/
+@RunWith(JUnitPlatform.class)
public abstract class GraphTest {
private final IRI uriRef1 =
@@ -66,15 +69,15 @@ public abstract class GraphTest {
@Test
public void testAddCountAndGetTriples() {
Graph graph = getEmptyGraph();
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
graph.add(triple1);
- Assert.assertEquals(1, graph.size());
+ Assertions.assertEquals(1, graph.size());
Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, uriRef1);
- Assert.assertTrue(tripleIter.hasNext());
+ Assertions.assertTrue(tripleIter.hasNext());
Triple tripleGot = tripleIter.next();
- Assert.assertEquals(triple1, tripleGot);
- Assert.assertFalse(tripleIter.hasNext());
+ Assertions.assertEquals(triple1, tripleGot);
+ Assertions.assertFalse(tripleIter.hasNext());
BlankNode bnode = new BlankNode() {};
graph.add(new TripleImpl(bnode, uriRef1, uriRef3));
graph.add(new TripleImpl(bnode, uriRef1, uriRef4));
@@ -86,86 +89,86 @@ public abstract class GraphTest {
subjectInMatchingTriples.add(triple.getSubject());
objectsInMatchingTriples.add(triple.getObject());
}
- Assert.assertEquals(1, subjectInMatchingTriples.size());
- Assert.assertEquals(2, objectsInMatchingTriples.size());
+ Assertions.assertEquals(1, subjectInMatchingTriples.size());
+ Assertions.assertEquals(2, objectsInMatchingTriples.size());
Set<RDFTerm> expectedObjects = new HashSet<RDFTerm>();
expectedObjects.add(uriRef3);
expectedObjects.add(uriRef4);
- Assert.assertEquals(expectedObjects, objectsInMatchingTriples);
+ Assertions.assertEquals(expectedObjects, objectsInMatchingTriples);
graph.add(new TripleImpl(bnode, uriRef4, bnode));
tripleIter = graph.filter(null, uriRef4, null);
- Assert.assertTrue(tripleIter.hasNext());
+ Assertions.assertTrue(tripleIter.hasNext());
Triple retrievedTriple = tripleIter.next();
- Assert.assertFalse(tripleIter.hasNext());
- Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
+ Assertions.assertFalse(tripleIter.hasNext());
+ Assertions.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
tripleIter = graph.filter(uriRef1, uriRef2, null);
- Assert.assertTrue(tripleIter.hasNext());
+ Assertions.assertTrue(tripleIter.hasNext());
retrievedTriple = tripleIter.next();
- Assert.assertFalse(tripleIter.hasNext());
- Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
+ Assertions.assertFalse(tripleIter.hasNext());
+ Assertions.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
}
@Test
public void testRemoveAllTriples() {
Graph graph = getEmptyGraph();
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
graph.add(new TripleImpl(uriRef1, uriRef2, uriRef3));
graph.add(new TripleImpl(uriRef2, uriRef3, uriRef4));
- Assert.assertEquals(2, graph.size());
+ Assertions.assertEquals(2, graph.size());
graph.clear();
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
}
@Test
public void testUseTypedLiterals() {
Graph graph = getEmptyGraph();
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
Literal value = new TypedLiteralImpl("<elem>value</elem>",xmlLiteralType);
final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
graph.add(triple1);
Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
- Assert.assertTrue(tripleIter.hasNext());
+ Assertions.assertTrue(tripleIter.hasNext());
RDFTerm gotValue = tripleIter.next().getObject();
- Assert.assertEquals(value, gotValue);
+ Assertions.assertEquals(value, gotValue);
}
@Test
public void testUseLanguageLiterals() {
Graph graph = getEmptyGraph();
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
Language language = new Language("it");
Literal value = new PlainLiteralImpl("<elem>value</elem>",language);
final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
graph.add(triple1);
Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
- Assert.assertTrue(tripleIter.hasNext());
+ Assertions.assertTrue(tripleIter.hasNext());
RDFTerm gotValue = tripleIter.next().getObject();
- Assert.assertEquals(value, gotValue);
- Assert.assertEquals(language, ((Literal)gotValue).getLanguage());
+ Assertions.assertEquals(value, gotValue);
+ Assertions.assertEquals(language, ((Literal)gotValue).getLanguage());
}
@Test
public void testRemoveViaIterator() {
Graph graph = getEmptyGraph();
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
graph.add(triple1);
final TripleImpl triple2 = new TripleImpl(uriRef1, uriRef2, uriRef4);
graph.add(triple2);
- Assert.assertEquals(2, graph.size());
+ Assertions.assertEquals(2, graph.size());
Iterator<Triple> iterator = graph.iterator();
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
}
@Test
public void testGetSize() throws Exception {
Graph graph = getEmptyGraph();
// The test graph must always be empty after test fixture setup
- Assert.assertEquals(0, graph.size());
+ Assertions.assertEquals(0, graph.size());
}
@@ -176,9 +179,9 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
- Assert.assertEquals(0, graph.size());
- Assert.assertTrue(graph.add(triple));
- Assert.assertEquals(1, graph.size());
+ Assertions.assertEquals(0, graph.size());
+ Assertions.assertTrue(graph.add(triple));
+ Assertions.assertEquals(1, graph.size());
}
@@ -189,10 +192,10 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
- Assert.assertEquals(0, graph.size());
- Assert.assertTrue(graph.add(triple));
- Assert.assertFalse(graph.add(triple)); // ImmutableGraph does not change
- Assert.assertEquals(1, graph.size());
+ Assertions.assertEquals(0, graph.size());
+ Assertions.assertTrue(graph.add(triple));
+ Assertions.assertFalse(graph.add(triple)); // ImmutableGraph does not change
+ Assertions.assertEquals(1, graph.size());
}
@@ -203,9 +206,9 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
- Assert.assertTrue(graph.add(triple));
- Assert.assertTrue(graph.remove(triple));
- Assert.assertEquals(0, graph.size());
+ Assertions.assertTrue(graph.add(triple));
+ Assertions.assertTrue(graph.remove(triple));
+ Assertions.assertEquals(0, graph.size());
}
@Test
@@ -219,11 +222,11 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/bob");
- Assert.assertTrue(graph.add(tripleAlice));
- Assert.assertTrue(graph.add(tripleBob));
- Assert.assertTrue(graph.remove(tripleAlice));
- Assert.assertFalse(graph.remove(tripleAlice));
- Assert.assertEquals(1, graph.size());
+ Assertions.assertTrue(graph.add(tripleAlice));
+ Assertions.assertTrue(graph.add(tripleBob));
+ Assertions.assertTrue(graph.remove(tripleAlice));
+ Assertions.assertFalse(graph.remove(tripleAlice));
+ Assertions.assertEquals(1, graph.size());
}
@Test
@@ -235,10 +238,10 @@ public abstract class GraphTest {
final PlainLiteralImpl name2 = new PlainLiteralImpl("http://example.org/people/bob");
final Triple tripleAlice = new TripleImpl(bNode, HAS_NAME, name);
final Triple tripleBob = new TripleImpl(bNode, HAS_NAME, name2);
- Assert.assertTrue(graph.add(tripleAlice));
- Assert.assertTrue(graph.add(tripleBob));
+ Assertions.assertTrue(graph.add(tripleAlice));
+ Assertions.assertTrue(graph.add(tripleBob));
Iterator<Triple> result = graph.filter(null, HAS_NAME, name);
- Assert.assertEquals(bNode, result.next().getSubject());
+ Assertions.assertEquals(bNode, result.next().getSubject());
}
@Test
@@ -248,8 +251,8 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
- Assert.assertTrue(graph.add(triple));
- Assert.assertTrue(graph.contains(triple));
+ Assertions.assertTrue(graph.add(triple));
+ Assertions.assertTrue(graph.contains(triple));
}
@@ -260,7 +263,7 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
- Assert.assertFalse(graph.contains(triple));
+ Assertions.assertFalse(graph.contains(triple));
}
@@ -275,8 +278,8 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/bob");
- Assert.assertTrue(graph.add(tripleAdd));
- Assert.assertFalse(graph.contains(tripleTest));
+ Assertions.assertTrue(graph.add(tripleAdd));
+ Assertions.assertFalse(graph.contains(tripleTest));
}
@@ -284,7 +287,7 @@ public abstract class GraphTest {
public void testFilterEmptyGraph() throws Exception {
Graph graph = getEmptyGraph();
Iterator<Triple> i = graph.filter(null, null, null);
- Assert.assertFalse(i.hasNext());
+ Assertions.assertFalse(i.hasNext());
}
@@ -295,12 +298,12 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/alice");
- Assert.assertTrue(graph.add(triple));
+ Assertions.assertTrue(graph.add(triple));
Iterator<Triple> i = graph.filter(null, null, null);
Collection<Triple> resultSet= toCollection(i);
- Assert.assertEquals(1, resultSet.size());
- Assert.assertTrue(resultSet.contains(triple));
+ Assertions.assertEquals(1, resultSet.size());
+ Assertions.assertTrue(resultSet.contains(triple));
}
@@ -315,8 +318,8 @@ public abstract class GraphTest {
"http://example.org/ontology/Person",
"http://example.org/ontology/hasName",
"http://example.org/people/bob");
- Assert.assertTrue(graph.add(tripleAlice));
- Assert.assertTrue(graph.add(tripleBob));
+ Assertions.assertTrue(graph.add(tripleAlice));
+ Assertions.assertTrue(graph.add(tripleBob));
Iterator<Triple> iterator;
Collection<Triple> resultSet;
@@ -325,22 +328,22 @@ public abstract class GraphTest {
iterator = graph.filter(null, null,
new IRI("http://example.org/people/bob"));
resultSet= toCollection(iterator);
- Assert.assertEquals(1, resultSet.size());
- Assert.assertTrue(resultSet.contains(tripleBob));
+ Assertions.assertEquals(1, resultSet.size());
+ Assertions.assertTrue(resultSet.contains(tripleBob));
// Find alice
iterator = graph.filter(null, null,
new IRI("http://example.org/people/alice"));
resultSet= toCollection(iterator);
- Assert.assertEquals(1, resultSet.size());
- Assert.assertTrue(resultSet.contains(tripleAlice));
+ Assertions.assertEquals(1, resultSet.size());
+ Assertions.assertTrue(resultSet.contains(tripleAlice));
// Find both
iterator = graph.filter(null, null, null);
resultSet= toCollection(iterator);
- Assert.assertEquals(2, resultSet.size());
- Assert.assertTrue(resultSet.contains(tripleAlice));
- Assert.assertTrue(resultSet.contains(tripleBob));
+ Assertions.assertEquals(2, resultSet.size());
+ Assertions.assertTrue(resultSet.contains(tripleAlice));
+ Assertions.assertTrue(resultSet.contains(tripleBob));
}
/*
@Test
@@ -351,24 +354,24 @@ public abstract class GraphTest {
mGraph.addGraphListener(listener, new FilterTriple(bnode2, null, literal2));
mGraph.addGraphListener(listener, new FilterTriple(null, uriRef4, literal2));
mGraph.add(trpl1);
- Assert.assertNull(listener.getEvents());
+ Assertions.assertNull(listener.getEvents());
mGraph.add(trpl2);
- Assert.assertEquals(1, listener.getEvents().size());
- Assert.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
- Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+ Assertions.assertEquals(1, listener.getEvents().size());
+ Assertions.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
+ Assertions.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
listener.resetEvents();
mGraph.remove(trpl2);
- Assert.assertEquals(1, listener.getEvents().size());
- Assert.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
- Assert.assertTrue(listener.getEvents().get(0) instanceof RemoveEvent);
+ Assertions.assertEquals(1, listener.getEvents().size());
+ Assertions.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
+ Assertions.assertTrue(listener.getEvents().get(0) instanceof RemoveEvent);
listener.resetEvents();
mGraph.add(trpl3);
- Assert.assertEquals(1, listener.getEvents().size());
- Assert.assertEquals(trpl3, listener.getEvents().get(0).getTriple());
- Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+ Assertions.assertEquals(1, listener.getEvents().size());
+ Assertions.assertEquals(trpl3, listener.getEvents().get(0).getTriple());
+ Assertions.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
listener.resetEvents();
mGraph.remove(trpl4);
- Assert.assertNull(listener.getEvents());
+ Assertions.assertNull(listener.getEvents());
}
@Test
@@ -386,20 +389,20 @@ public abstract class GraphTest {
mGraph.addAll(triples);
List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
Set<Triple> cumulatedTriples = getCumulatedTriples(cumulatedEvents);
- Assert.assertEquals(3, cumulatedEvents.size());
- Assert.assertTrue(cumulatedEvents.get(0) instanceof AddEvent);
- Assert.assertTrue(cumulatedTriples.contains(trpl2));
- Assert.assertTrue(cumulatedTriples.contains(trpl3));
- Assert.assertTrue(cumulatedTriples.contains(trpl4));
+ Assertions.assertEquals(3, cumulatedEvents.size());
+ Assertions.assertTrue(cumulatedEvents.get(0) instanceof AddEvent);
+ Assertions.assertTrue(cumulatedTriples.contains(trpl2));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl3));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl4));
listener.resetCumulatedEvents();
mGraph.removeAll(triples);
cumulatedEvents = listener.getCumulatedEvents();
cumulatedTriples = getCumulatedTriples(cumulatedEvents);
- Assert.assertEquals(3, cumulatedEvents.size());
- Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
- Assert.assertTrue(cumulatedTriples.contains(trpl2));
- Assert.assertTrue(cumulatedTriples.contains(trpl3));
- Assert.assertTrue(cumulatedTriples.contains(trpl4));
+ Assertions.assertEquals(3, cumulatedEvents.size());
+ Assertions.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+ Assertions.assertTrue(cumulatedTriples.contains(trpl2));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl3));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl4));
}
@Test
@@ -420,9 +423,9 @@ public abstract class GraphTest {
result.remove();
}
List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
- Assert.assertEquals(1, cumulatedEvents.size());
- Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
- Assert.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
+ Assertions.assertEquals(1, cumulatedEvents.size());
+ Assertions.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+ Assertions.assertEquals(trpl2, listener.getEvents().get(0).getTriple());
}
@Test
@@ -444,11 +447,11 @@ public abstract class GraphTest {
}
List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
Set<Triple> cumulatedTriples = getCumulatedTriples(cumulatedEvents);
- Assert.assertEquals(3, cumulatedEvents.size());
- Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
- Assert.assertTrue(cumulatedTriples.contains(trpl2));
- Assert.assertTrue(cumulatedTriples.contains(trpl3));
- Assert.assertTrue(cumulatedTriples.contains(trpl4));
+ Assertions.assertEquals(3, cumulatedEvents.size());
+ Assertions.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+ Assertions.assertTrue(cumulatedTriples.contains(trpl2));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl3));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl4));
}
@Test
@@ -466,11 +469,11 @@ public abstract class GraphTest {
mGraph.clear();
List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
Set<Triple> cumulatedTriples = getCumulatedTriples(cumulatedEvents);
- Assert.assertEquals(3, cumulatedEvents.size());
- Assert.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
- Assert.assertTrue(cumulatedTriples.contains(trpl2));
- Assert.assertTrue(cumulatedTriples.contains(trpl3));
- Assert.assertTrue(cumulatedTriples.contains(trpl4));
+ Assertions.assertEquals(3, cumulatedEvents.size());
+ Assertions.assertTrue(cumulatedEvents.get(0) instanceof RemoveEvent);
+ Assertions.assertTrue(cumulatedTriples.contains(trpl2));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl3));
+ Assertions.assertTrue(cumulatedTriples.contains(trpl4));
}
private Set<Triple> getCumulatedTriples(List<GraphEvent> cumulatedEvents) {
@@ -497,13 +500,13 @@ public abstract class GraphTest {
mGraph.add(triple2);
mGraph.add(triple3);
Thread.sleep(1500);
- Assert.assertEquals(3, listener.getEvents().size());
- Assert.assertEquals(triple1, listener.getEvents().get(0).getTriple());
- Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
- Assert.assertEquals(triple2, listener.getEvents().get(1).getTriple());
- Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
- Assert.assertEquals(triple3, listener.getEvents().get(2).getTriple());
- Assert.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+ Assertions.assertEquals(3, listener.getEvents().size());
+ Assertions.assertEquals(triple1, listener.getEvents().get(0).getTriple());
+ Assertions.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+ Assertions.assertEquals(triple2, listener.getEvents().get(1).getTriple());
+ Assertions.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
+ Assertions.assertEquals(triple3, listener.getEvents().get(2).getTriple());
+ Assertions.assertTrue(listener.getEvents().get(0) instanceof AddEvent);
}
private static class TestGraphListener implements GraphListener {