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:16:06 UTC

[clerezza] branch master updated: CLEREZZA-1023: Use JUnit 5 in representation

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 d426281  CLEREZZA-1023: Use JUnit 5 in representation
d426281 is described below

commit d426281c9650794442c0452e2e69ed838644e982
Author: Hasan <ha...@apache.org>
AuthorDate: Tue May 25 16:15:49 2021 +0200

    CLEREZZA-1023: Use JUnit 5 in representation
---
 .../apache/clerezza/representation/ParserTest.java  | 21 ++++++++++++---------
 .../clerezza/representation/SerializerTest.java     | 21 ++++++++++++---------
 .../representation/TestServiceManagedProvider.java  |  9 ++++++---
 3 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java b/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
index 0e58256..bfe8cd8 100644
--- a/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
+++ b/representation/src/test/java/org/apache/clerezza/representation/ParserTest.java
@@ -18,10 +18,12 @@
 
 package org.apache.clerezza.representation;
 
-import junit.framework.Assert;
 import org.apache.clerezza.Graph;
 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;
 
 import java.io.InputStream;
 
@@ -29,6 +31,7 @@ import java.io.InputStream;
  *
  * @author reto
  */
+@RunWith(JUnitPlatform.class)
 public class ParserTest {
 
     private static boolean providerAInvoked;
@@ -42,7 +45,7 @@ public class ParserTest {
         parser.bindParsingProvider(parsingProviderA);
         providerAInvoked = false;
         parser.parse(null, "application/x-fantasy2+rdf");
-        Assert.assertTrue(providerAInvoked);
+        Assertions.assertTrue(providerAInvoked);
     }
     
     @Test
@@ -53,19 +56,19 @@ public class ParserTest {
         providerAInvoked = false;
         providerBInvoked = false;
         parser.parse(null, "application/x-fantasy2+rdf");
-        Assert.assertFalse(providerAInvoked);
-        Assert.assertTrue(providerBInvoked);
+        Assertions.assertFalse(providerAInvoked);
+        Assertions.assertTrue(providerBInvoked);
         providerAInvoked = false;
         providerBInvoked = false;
         parser.parse(null, "application/x-fantasy1+rdf");
-        Assert.assertTrue(providerAInvoked);
-        Assert.assertFalse(providerBInvoked);
+        Assertions.assertTrue(providerAInvoked);
+        Assertions.assertFalse(providerBInvoked);
         parser.unbindParsingProvider(parsingProviderB);
         providerAInvoked = false;
         providerBInvoked = false;
         parser.parse(null, "application/x-fantasy2+rdf");
-        Assert.assertTrue(providerAInvoked);
-        Assert.assertFalse(providerBInvoked);
+        Assertions.assertTrue(providerAInvoked);
+        Assertions.assertFalse(providerBInvoked);
         
     }
 
diff --git a/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java b/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
index a5e6569..a7a8187 100644
--- a/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
+++ b/representation/src/test/java/org/apache/clerezza/representation/SerializerTest.java
@@ -18,9 +18,11 @@
 
 package org.apache.clerezza.representation;
 
-import junit.framework.Assert;
 import org.apache.clerezza.Graph;
-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.OutputStream;
 
@@ -28,6 +30,7 @@ import java.io.OutputStream;
  *
  * @author mir
  */
+@RunWith(JUnitPlatform.class)
 public class SerializerTest {
 
     private static boolean providerAInvoked;
@@ -41,7 +44,7 @@ public class SerializerTest {
         serializer.bindSerializingProvider(serializingProviderA);
         providerAInvoked = false;
         serializer.serialize(null, null, "application/x-fantasy2+rdf");
-        Assert.assertTrue(providerAInvoked);
+        Assertions.assertTrue(providerAInvoked);
     }
     
     @Test
@@ -52,19 +55,19 @@ public class SerializerTest {
         providerAInvoked = false;
         providerBInvoked = false;
         serializer.serialize(null, null, "application/x-fantasy2+rdf");
-        Assert.assertFalse(providerAInvoked);
-        Assert.assertTrue(providerBInvoked);
+        Assertions.assertFalse(providerAInvoked);
+        Assertions.assertTrue(providerBInvoked);
         providerAInvoked = false;
         providerBInvoked = false;
         serializer.serialize(null, null, "application/x-fantasy1+rdf");
-        Assert.assertTrue(providerAInvoked);
-        Assert.assertFalse(providerBInvoked);
+        Assertions.assertTrue(providerAInvoked);
+        Assertions.assertFalse(providerBInvoked);
         serializer.unbindSerializingProvider(serializingProviderB);
         providerAInvoked = false;
         providerBInvoked = false;
         serializer.serialize(null, null, "application/x-fantasy2+rdf");
-        Assert.assertTrue(providerAInvoked);
-        Assert.assertFalse(providerBInvoked);
+        Assertions.assertTrue(providerAInvoked);
+        Assertions.assertFalse(providerBInvoked);
         
     }
 
diff --git a/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java b/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
index 6789407..7f93a3e 100644
--- a/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
+++ b/representation/src/test/java/org/apache/clerezza/representation/TestServiceManagedProvider.java
@@ -20,8 +20,10 @@ package org.apache.clerezza.representation;
 
 import org.apache.clerezza.Graph;
 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.InputStream;
 
@@ -31,6 +33,7 @@ import java.io.InputStream;
  *
  * @author reto
  */
+@RunWith(JUnitPlatform.class)
 @SupportedFormat("application/x-test+rdf")
 public class TestServiceManagedProvider implements ParsingProvider {
 
@@ -45,6 +48,6 @@ public class TestServiceManagedProvider implements ParsingProvider {
     public void registerOneProvider() {
         Parser parser = Parser.getInstance();
         parser.parse(null, "application/x-test+rdf");
-        Assert.assertTrue(parseInvoked);
+        Assertions.assertTrue(parseInvoked);
     }
 }