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/25 14:06:31 UTC
[clerezza] branch master updated: CLEREZZA-1023: Use JUnit 5 in
api-implementation
This is an automated email from the ASF dual-hosted git repository.
hasan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/clerezza.git
The following commit(s) were added to refs/heads/master by this push:
new 18100af CLEREZZA-1023: Use JUnit 5 in api-implementation
18100af is described below
commit 18100af22c6cbcc496bbdb3c5df8d44d3bb5b65f
Author: Hasan <ha...@apache.org>
AuthorDate: Tue May 25 16:03:41 2021 +0200
CLEREZZA-1023: Use JUnit 5 in api-implementation
---
.../clerezza/implementation/LanguageTest.java | 15 +-
.../apache/clerezza/implementation/UriRefTest.java | 13 +-
.../clerezza/implementation/graph/GraphTest.java | 217 +++++++++++----------
.../implementation/graph/SimpleGraphTest.java | 29 +--
.../graphmatching/GraphMatcherTest.java | 61 +++---
.../graphmatching/HashMatchingTest.java | 13 +-
.../graphmatching/PermutationIteratorTest.java | 15 +-
.../implementation/literal/LiteralFactoryTest.java | 35 ++--
.../literal/PlainLiteralImplTest.java | 25 +--
.../implementation/literal/TripleImplTest.java | 12 +-
.../literal/TypedLiteralImplTest.java | 18 +-
11 files changed, 244 insertions(+), 209 deletions(-)
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/LanguageTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/LanguageTest.java
index 06a8f50..69e0707 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/LanguageTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/LanguageTest.java
@@ -18,29 +18,32 @@
package org.apache.clerezza.implementation;
import org.apache.clerezza.Language;
-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;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class LanguageTest {
@Test
public void languageEqualityTest() {
Language lang1 = new Language("DE");
Language lang2 = new Language("DE");
- Assert.assertEquals(lang1, lang2);
- Assert.assertEquals(lang1.hashCode(), lang2.hashCode());
+ Assertions.assertEquals(lang1, lang2);
+ Assertions.assertEquals(lang1.hashCode(), lang2.hashCode());
Language lang3 = new Language("EN");
- Assert.assertFalse(lang1.equals(lang3));
+ Assertions.assertFalse(lang1.equals(lang3));
}
@Test
public void toStringTest() {
final String id = "de";
Language lang1 = new Language(id);
- Assert.assertEquals(lang1.toString(), id);
+ Assertions.assertEquals(lang1.toString(), id);
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/UriRefTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/UriRefTest.java
index a484094..5a5ea40 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/UriRefTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/UriRefTest.java
@@ -18,8 +18,10 @@
package org.apache.clerezza.implementation;
import org.apache.clerezza.IRI;
-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.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@@ -27,6 +29,7 @@ import java.net.URLEncoder;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class UriRefTest {
@Test
@@ -34,16 +37,16 @@ public class UriRefTest {
String uriRefString = "http://example.org/üöä";
IRI uriRef1 = new IRI(uriRefString);
IRI uriRef2 = new IRI(uriRefString);
- Assert.assertEquals(uriRef1, uriRef2);
+ Assertions.assertEquals(uriRef1, uriRef2);
IRI uriRef3 = new IRI(URLEncoder.encode(uriRefString, "utf-8"));
- Assert.assertFalse(uriRef1.equals(uriRef3));
+ Assertions.assertFalse(uriRef1.equals(uriRef3));
}
@Test
public void toStringTest() {
String uriRefString = "http://example.org/üöä";
IRI uriRef = new IRI(uriRefString);
- Assert.assertEquals("<" + uriRefString + ">", uriRef.toString());
+ Assertions.assertEquals("<" + uriRefString + ">", uriRef.toString());
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/GraphTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/GraphTest.java
index c3a00b5..e19a646 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/GraphTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/GraphTest.java
@@ -21,8 +21,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.*;
@@ -32,6 +34,7 @@ import java.util.*;
*
* @author reto, szalay, mir, hhn
*/
+@RunWith(JUnitPlatform.class)
public abstract class GraphTest {
private final IRI uriRef1 =
@@ -65,15 +68,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));
@@ -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));
}
/*
@@ -352,24 +355,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
@@ -387,20 +390,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
@@ -421,9 +424,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
@@ -445,11 +448,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
@@ -467,11 +470,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) {
@@ -498,13 +501,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 {
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/SimpleGraphTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/SimpleGraphTest.java
index 553257f..22aab42 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/SimpleGraphTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/graph/SimpleGraphTest.java
@@ -21,8 +21,10 @@ import org.apache.clerezza.IRI;
import org.apache.clerezza.Triple;
import org.apache.clerezza.implementation.TripleImpl;
import org.apache.clerezza.implementation.in_memory.SimpleGraph;
-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.ConcurrentModificationException;
import java.util.Iterator;
@@ -30,6 +32,7 @@ import java.util.Iterator;
/**
* @author mir
*/
+@RunWith(JUnitPlatform.class)
public class SimpleGraphTest {
private IRI uriRef1 = new IRI("http://example.org/foo");
@@ -54,7 +57,7 @@ public class SimpleGraphTest {
Triple triple = iter.next();
iter.remove();
}
- Assert.assertEquals(0, stc.size());
+ Assertions.assertEquals(0, stc.size());
}
@Test
@@ -70,7 +73,7 @@ public class SimpleGraphTest {
stc2.add(triple3);
stc2.add(triple5);
stc.removeAll(stc2);
- Assert.assertEquals(2, stc.size());
+ Assertions.assertEquals(2, stc.size());
}
@Test
@@ -86,10 +89,10 @@ public class SimpleGraphTest {
Triple triple = iter.next();
iter.remove();
}
- Assert.assertEquals(3, stc.size());
+ Assertions.assertEquals(3, stc.size());
}
- @Test(expected = ConcurrentModificationException.class)
+ @Test
public void remove() {
SimpleGraph stc = new SimpleGraph();
stc.setCheckConcurrency(true);
@@ -99,10 +102,14 @@ public class SimpleGraphTest {
stc.add(triple4);
stc.add(triple5);
Iterator<Triple> iter = stc.filter(uriRef1, null, null);
- while (iter.hasNext()) {
- Triple triple = iter.next();
- stc.remove(triple);
- }
- Assert.assertEquals(3, stc.size());
+
+ Assertions.assertThrows(ConcurrentModificationException.class, () -> {
+ while (iter.hasNext()) {
+ Triple triple = iter.next();
+ stc.remove(triple);
+ }
+ });
+
+ Assertions.assertEquals(4, stc.size());
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/GraphMatcherTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/GraphMatcherTest.java
index bf09547..6e34cc5 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/GraphMatcherTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/GraphMatcherTest.java
@@ -23,14 +23,17 @@ import org.apache.clerezza.Graph;
import org.apache.clerezza.IRI;
import org.apache.clerezza.implementation.TripleImpl;
import org.apache.clerezza.implementation.in_memory.SimpleGraph;
-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.Map;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class GraphMatcherTest {
final static IRI u1 = new IRI("http://example.org/u1");
@@ -40,8 +43,8 @@ public class GraphMatcherTest {
Graph tc1 = new SimpleGraph();
Graph tc2 = new SimpleGraph();
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(0, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(0, mapping.size());
}
@Test
@@ -50,7 +53,7 @@ public class GraphMatcherTest {
tc1.add(new TripleImpl(u1, u1, u1));
Graph tc2 = new SimpleGraph();
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNull(mapping);
+ Assertions.assertNull(mapping);
}
@Test
@@ -60,8 +63,8 @@ public class GraphMatcherTest {
Graph tc2 = new SimpleGraph();
tc2.add(new TripleImpl(u1, u1, u1));
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(0, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(0, mapping.size());
}
@Test
@@ -71,8 +74,8 @@ public class GraphMatcherTest {
Graph tc2 = new SimpleGraph();
tc2.add(new TripleImpl(u1, u1, new BlankNode()));
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(1, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(1, mapping.size());
}
@Test
@@ -82,8 +85,8 @@ public class GraphMatcherTest {
Graph tc2 = new SimpleGraph();
tc2.add(new TripleImpl(new BlankNode(), u1, new BlankNode()));
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(2, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(2, mapping.size());
}
@Test
@@ -95,7 +98,7 @@ public class GraphMatcherTest {
Graph tc2 = new SimpleGraph();
tc2.add(new TripleImpl(new BlankNode(), u1, new BlankNode()));
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNull(mapping);
+ Assertions.assertNull(mapping);
}
private Graph generateCircle(int size) {
@@ -122,8 +125,8 @@ public class GraphMatcherTest {
Graph tc1 = generateCircle(2);
Graph tc2 = generateCircle(2);
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(2, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(2, mapping.size());
}
@Test
@@ -131,8 +134,8 @@ public class GraphMatcherTest {
Graph tc1 = generateCircle(5);
Graph tc2 = generateCircle(5);
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(5, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(5, mapping.size());
}
@Test
@@ -142,11 +145,11 @@ public class GraphMatcherTest {
tc1.addAll(generateCircle(3, crossing));
Graph tc2 = generateCircle(2, crossing);
tc2.addAll(generateCircle(3, crossing));
- Assert.assertEquals(5, tc1.size());
+ Assertions.assertEquals(5, tc1.size());
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
+ Assertions.assertNotNull(mapping);
//a circle of 2 with 1 bnode and one of 2 bnodes
- Assert.assertEquals(3, mapping.size());
+ Assertions.assertEquals(3, mapping.size());
}
@Test
@@ -157,11 +160,11 @@ public class GraphMatcherTest {
BlankNodeOrIRI crossing2 = new BlankNode();
Graph tc2 = generateCircle(2, crossing2);
tc2.addAll(generateCircle(3, crossing2));
- Assert.assertEquals(5, tc1.size());
+ Assertions.assertEquals(5, tc1.size());
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
+ Assertions.assertNotNull(mapping);
//a circle of 2 and one of 3 with one common node
- Assert.assertEquals(4, mapping.size());
+ Assertions.assertEquals(4, mapping.size());
}
@Test
@@ -172,9 +175,9 @@ public class GraphMatcherTest {
BlankNodeOrIRI crossing2 = new BlankNode();
Graph tc2 = generateCircle(3, crossing2);
tc2.addAll(generateCircle(3, crossing2));
- Assert.assertEquals(6, tc1.size());
+ Assertions.assertEquals(6, tc1.size());
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNull(mapping);
+ Assertions.assertNull(mapping);
}
@Test
@@ -185,10 +188,10 @@ public class GraphMatcherTest {
BlankNodeOrIRI start2 = new BlankNode();
Graph tc2 = Utils4Testing.generateLine(5, start2);
tc2.addAll(Utils4Testing.generateLine(4, start2));
- Assert.assertEquals(9, tc1.size());
+ Assertions.assertEquals(9, tc1.size());
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNotNull(mapping);
- Assert.assertEquals(10, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(10, mapping.size());
}
@Test
@@ -199,8 +202,8 @@ public class GraphMatcherTest {
BlankNodeOrIRI start2 = new BlankNode();
Graph tc2 = Utils4Testing.generateLine(3, start2);
tc2.addAll(Utils4Testing.generateLine(3, start2));
- Assert.assertEquals(9, tc1.size());
+ Assertions.assertEquals(9, tc1.size());
final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
- Assert.assertNull(mapping);
+ Assertions.assertNull(mapping);
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/HashMatchingTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/HashMatchingTest.java
index 9dc1109..f9daf71 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/HashMatchingTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/HashMatchingTest.java
@@ -21,14 +21,17 @@ package org.apache.clerezza.implementation.graphmatching;
import org.apache.clerezza.BlankNodeOrIRI;
import org.apache.clerezza.BlankNode;
import org.apache.clerezza.Graph;
-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.Map;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class HashMatchingTest {
@Test
@@ -39,10 +42,10 @@ public class HashMatchingTest {
BlankNodeOrIRI start2 = new BlankNode();
Graph tc2 = Utils4Testing.generateLine(5, start2);
tc2.addAll(Utils4Testing.generateLine(4, start2));
- Assert.assertEquals(9, tc1.size());
+ Assertions.assertEquals(9, tc1.size());
final Map<BlankNode, BlankNode> mapping = new HashMatching(tc1, tc2).getMatchings();
- Assert.assertNotNull(mapping);
- Assert.assertEquals(10, mapping.size());
+ Assertions.assertNotNull(mapping);
+ Assertions.assertEquals(10, mapping.size());
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/PermutationIteratorTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/PermutationIteratorTest.java
index a05ab69..0da29dc 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/PermutationIteratorTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/graphmatching/PermutationIteratorTest.java
@@ -18,8 +18,10 @@
package org.apache.clerezza.implementation.graphmatching;
-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.ArrayList;
import java.util.HashSet;
@@ -29,13 +31,14 @@ import java.util.Set;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class PermutationIteratorTest {
@Test
public void simple() {
List<String> list = new ArrayList<String>();
PermutationIterator<String> pi = new PermutationIterator<String>(list);
- Assert.assertFalse(pi.hasNext());
+ Assertions.assertFalse(pi.hasNext());
}
@Test
@@ -43,7 +46,7 @@ public class PermutationIteratorTest {
List<String> list = new ArrayList<String>();
list.add("Hasan");
PermutationIterator<String> pi = new PermutationIterator<String>(list);
- Assert.assertTrue(pi.hasNext());
+ Assertions.assertTrue(pi.hasNext());
}
@Test
@@ -56,7 +59,7 @@ public class PermutationIteratorTest {
while (pi.hasNext()) {
permutations.add(pi.next());
}
- Assert.assertEquals(2, permutations.size());
+ Assertions.assertEquals(2, permutations.size());
}
@Test
@@ -70,7 +73,7 @@ public class PermutationIteratorTest {
while (pi.hasNext()) {
permutations.add(pi.next());
}
- Assert.assertEquals(6, permutations.size());
+ Assertions.assertEquals(6, permutations.size());
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/LiteralFactoryTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/LiteralFactoryTest.java
index 36695d2..d18515e 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/LiteralFactoryTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/LiteralFactoryTest.java
@@ -19,8 +19,10 @@ package org.apache.clerezza.implementation.literal;
import org.apache.clerezza.IRI;
import org.apache.clerezza.Literal;
-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.Arrays;
import java.util.Date;
@@ -28,16 +30,19 @@ import java.util.Date;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class LiteralFactoryTest {
/**
* Test that a NoConvertorException thrown for an unsupported convertor
*/
- @Test(expected = NoConvertorException.class)
+ @Test
public void unavailableConvertor() {
Object value = new Object() {
};
- LiteralFactory.getInstance().createTypedLiteral(value);
+ Assertions.assertThrows(NoConvertorException.class, () ->
+ LiteralFactory.getInstance().createTypedLiteral(value)
+ );
}
/**
@@ -50,13 +55,13 @@ public class LiteralFactoryTest {
bytes[i] = i;
}
Literal literal = LiteralFactory.getInstance().createTypedLiteral(bytes);
- Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#base64Binary"),
+ Assertions.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#base64Binary"),
literal.getDataType());
//we are using bytes.getClass() but there should be a way to get
//that instance of Class without getting it from an instance
//but this is java-bug 4071439 (would like byte[].class or byte.class.getArrayType())
byte[] bytesBack = LiteralFactory.getInstance().createObject(bytes.getClass(), literal);
- Assert.assertTrue(Arrays.equals(bytes, bytesBack));
+ Assertions.assertTrue(Arrays.equals(bytes, bytesBack));
}
@@ -67,10 +72,10 @@ public class LiteralFactoryTest {
public void dateConversion() {
Date date = new Date();
Literal literal = LiteralFactory.getInstance().createTypedLiteral(date);
- Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#dateTime"),
+ Assertions.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#dateTime"),
literal.getDataType());
Date dateBack = LiteralFactory.getInstance().createObject(Date.class, literal);
- Assert.assertEquals(date.getTime(), dateBack.getTime());
+ Assertions.assertEquals(date.getTime(), dateBack.getTime());
}
@@ -81,10 +86,10 @@ public class LiteralFactoryTest {
public void stringConversion() {
String value = "Hello world";
Literal literal = LiteralFactory.getInstance().createTypedLiteral(value);
- Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#string"),
+ Assertions.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#string"),
literal.getDataType());
String valueBack = LiteralFactory.getInstance().createObject(String.class, literal);
- Assert.assertEquals(value, valueBack);
+ Assertions.assertEquals(value, valueBack);
}
@@ -95,10 +100,10 @@ public class LiteralFactoryTest {
public void intConversion() {
int value = 3;
Literal literal = LiteralFactory.getInstance().createTypedLiteral(value);
- Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#int"),
+ Assertions.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#int"),
literal.getDataType());
Integer valueBack = LiteralFactory.getInstance().createObject(Integer.class, literal);
- Assert.assertEquals(value, valueBack.intValue());
+ Assertions.assertEquals(value, valueBack.intValue());
}
@@ -109,12 +114,10 @@ public class LiteralFactoryTest {
public void longConversion() {
long value = 332314646;
Literal literal = LiteralFactory.getInstance().createTypedLiteral(value);
- Assert.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#long"),
+ Assertions.assertEquals(new IRI("http://www.w3.org/2001/XMLSchema#long"),
literal.getDataType());
Long valueBack = LiteralFactory.getInstance().createObject(Long.class, literal);
- Assert.assertEquals(value, valueBack.longValue());
+ Assertions.assertEquals(value, valueBack.longValue());
}
-
-
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/PlainLiteralImplTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/PlainLiteralImplTest.java
index 2cd0786..ecf81c0 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/PlainLiteralImplTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/PlainLiteralImplTest.java
@@ -19,12 +19,15 @@ package org.apache.clerezza.implementation.literal;
import org.apache.clerezza.Language;
import org.apache.clerezza.Literal;
-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;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class PlainLiteralImplTest {
@Test
@@ -32,10 +35,10 @@ public class PlainLiteralImplTest {
String stringValue = "some text";
Literal literal1 = new PlainLiteralImpl(stringValue);
Literal literal2 = new PlainLiteralImpl(stringValue);
- Assert.assertEquals(literal1, literal2);
- Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
+ Assertions.assertEquals(literal1, literal2);
+ Assertions.assertEquals(literal1.hashCode(), literal2.hashCode());
Literal literal3 = new PlainLiteralImpl("something else");
- Assert.assertFalse(literal1.equals(literal3));
+ Assertions.assertFalse(literal1.equals(literal3));
}
@Test
@@ -44,14 +47,14 @@ public class PlainLiteralImplTest {
Language lang = new Language("en-ca");
Literal literal1 = new PlainLiteralImpl(stringValue, lang);
Literal literal2 = new PlainLiteralImpl(stringValue, lang);
- Assert.assertEquals(literal1, literal2);
- Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
+ Assertions.assertEquals(literal1, literal2);
+ Assertions.assertEquals(literal1.hashCode(), literal2.hashCode());
Language lang2 = new Language("de");
Literal literal3 = new PlainLiteralImpl(stringValue, lang2);
- Assert.assertFalse(literal1.equals(literal3));
+ Assertions.assertFalse(literal1.equals(literal3));
Literal literal4 = new PlainLiteralImpl(stringValue, null);
- Assert.assertFalse(literal3.equals(literal4));
- Assert.assertFalse(literal4.equals(literal3));
+ Assertions.assertFalse(literal3.equals(literal4));
+ Assertions.assertFalse(literal4.equals(literal3));
}
/**
@@ -62,7 +65,7 @@ public class PlainLiteralImplTest {
String stringValue = "some text";
Language language = new Language("en");
Literal literal = new PlainLiteralImpl(stringValue, language);
- Assert.assertEquals(literal.getDataType().hashCode() + stringValue.hashCode() + language.hashCode(), literal.hashCode());
+ Assertions.assertEquals(literal.getDataType().hashCode() + stringValue.hashCode() + language.hashCode(), literal.hashCode());
}
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TripleImplTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TripleImplTest.java
index 39dc6a7..f9ac323 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TripleImplTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TripleImplTest.java
@@ -17,17 +17,20 @@
*/
package org.apache.clerezza.implementation.literal;
-import junit.framework.Assert;
import org.apache.clerezza.BlankNodeOrIRI;
import org.apache.clerezza.IRI;
import org.apache.clerezza.RDFTerm;
import org.apache.clerezza.Triple;
import org.apache.clerezza.implementation.TripleImpl;
-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;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class TripleImplTest {
@Test
@@ -37,8 +40,7 @@ public class TripleImplTest {
RDFTerm object = new PlainLiteralImpl("property value");
Triple triple1 = new TripleImpl(subject, predicate, object);
Triple triple2 = new TripleImpl(subject, predicate, object);
- Assert.assertEquals(triple1.hashCode(), triple2.hashCode());
- Assert.assertEquals(triple1, triple2);
+ Assertions.assertEquals(triple1.hashCode(), triple2.hashCode());
+ Assertions.assertEquals(triple1, triple2);
}
-
}
diff --git a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TypedLiteralImplTest.java b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TypedLiteralImplTest.java
index 1928fed..a3e33df 100644
--- a/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TypedLiteralImplTest.java
+++ b/api-implementation/src/test/java/org/apache/clerezza/implementation/literal/TypedLiteralImplTest.java
@@ -17,30 +17,32 @@
*/
package org.apache.clerezza.implementation.literal;
-import junit.framework.Assert;
import org.apache.clerezza.Literal;
import org.apache.clerezza.IRI;
-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;
/**
* @author reto
*/
+@RunWith(JUnitPlatform.class)
public class TypedLiteralImplTest {
-
@Test
public void typedLiteralEquality() {
String stringValue = "some text";
IRI uriRef = new IRI("http://example.org/datatypes/magic");
Literal literal1 = new TypedLiteralImpl(stringValue, uriRef);
Literal literal2 = new TypedLiteralImpl(stringValue, uriRef);
- Assert.assertEquals(literal1, literal2);
- Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
+ Assertions.assertEquals(literal1, literal2);
+ Assertions.assertEquals(literal1.hashCode(), literal2.hashCode());
Literal literal3 = new TypedLiteralImpl("something else", uriRef);
- Assert.assertFalse(literal1.equals(literal3));
+ Assertions.assertFalse(literal1.equals(literal3));
IRI uriRef2 = new IRI("http://example.org/datatypes/other");
Literal literal4 = new TypedLiteralImpl(stringValue, uriRef2);
- Assert.assertFalse(literal1.equals(literal4));
+ Assertions.assertFalse(literal1.equals(literal4));
}
/**
@@ -51,7 +53,7 @@ public class TypedLiteralImplTest {
String stringValue = "some text";
IRI uriRef = new IRI("http://example.org/datatypes/magic");
Literal literal = new TypedLiteralImpl(stringValue, uriRef);
- Assert.assertEquals(stringValue.hashCode() + uriRef.hashCode(), literal.hashCode());
+ Assertions.assertEquals(stringValue.hashCode() + uriRef.hashCode(), literal.hashCode());
}
}