You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by do...@apache.org on 2022/03/25 13:54:57 UTC

[accumulo-testing] branch main updated: Migrate all tests to JUnit5 (#198)

This is an automated email from the ASF dual-hosted git repository.

domgarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git


The following commit(s) were added to refs/heads/main by this push:
     new d1993ba  Migrate all tests to JUnit5 (#198)
d1993ba is described below

commit d1993ba4a81612bdf9f3f58937c687352612e0e4
Author: Dom G <do...@gmail.com>
AuthorDate: Fri Mar 25 09:54:51 2022 -0400

    Migrate all tests to JUnit5 (#198)
---
 pom.xml                                                    | 10 +++++-----
 .../apache/accumulo/testing/randomwalk/FrameworkTest.java  | 14 +++++++-------
 .../testing/randomwalk/ReplicationRandomWalkIT.java        | 11 +++++++----
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/pom.xml b/pom.xml
index 783ba1f..b0a3444 100644
--- a/pom.xml
+++ b/pom.xml
@@ -96,11 +96,6 @@
       <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.accumulo</groupId>
       <artifactId>accumulo-minicluster</artifactId>
       <scope>test</scope>
@@ -110,6 +105,11 @@
       <artifactId>accumulo-test</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
diff --git a/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java b/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
index eb7925c..ec7803c 100644
--- a/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
+++ b/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
@@ -16,8 +16,8 @@
  */
 package org.apache.accumulo.testing.randomwalk;
 
-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.io.File;
 import java.io.IOException;
@@ -37,7 +37,7 @@ public class FrameworkTest {
 
   // Need to use fully qualified name here because of conflict with
   // org.apache.accumulo.testing.randomwalk.Test
-  @org.junit.Test
+  @org.junit.jupiter.api.Test
   public void testXML()
       throws SAXException, URISyntaxException, ParserConfigurationException, IOException {
     SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
@@ -49,21 +49,21 @@ public class FrameworkTest {
     DocumentBuilder docbuilder = dbf.newDocumentBuilder();
     Document document = docbuilder.parse(getFile("/randomwalk/modules/unit/Basic.xml"));
 
-    assertNotEquals("Parsing randomwalk xml should result in nodes.", 0,
-        document.getChildNodes().getLength());
+    assertNotEquals(0, document.getChildNodes().getLength(),
+        "Parsing randomwalk xml should result in nodes.");
   }
 
   private File getFile(String resource) throws URISyntaxException {
     return new File(this.getClass().getResource(resource).toURI());
   }
 
-  @org.junit.Test
+  @org.junit.jupiter.api.Test
   public void testRWTest() {
     Test t1 = new CreateTable();
     assertEquals("org.apache.accumulo.testing.randomwalk.unit.CreateTable", t1.toString());
 
     Test t2 = new CreateTable();
-    assertEquals("CreateTable test nodes were not equal.", t1, t2);
+    assertEquals(t1, t2, "CreateTable test nodes were not equal.");
   }
 
 }
diff --git a/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java b/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
index c66d455..8b428c1 100644
--- a/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
+++ b/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk;
 
+import static java.util.concurrent.TimeUnit.MINUTES;
 import static org.apache.accumulo.core.conf.Property.TSERV_NATIVEMAP_ENABLED;
 import static org.apache.accumulo.core.conf.Property.TSERV_WAL_MAX_SIZE;
 
@@ -25,10 +26,11 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.test.functional.ConfigurableMacBase;
 import org.apache.hadoop.conf.Configuration;
 import org.easymock.EasyMock;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
-@Ignore("Replication ITs are not stable and not currently maintained")
+@Disabled("Replication ITs are not stable and not currently maintained")
 public class ReplicationRandomWalkIT extends ConfigurableMacBase {
 
   @Override
@@ -39,7 +41,8 @@ public class ReplicationRandomWalkIT extends ConfigurableMacBase {
   }
 
   @Deprecated
-  @Test(timeout = 5 * 60 * 1000)
+  @Test
+  @Timeout(value = 5, unit = MINUTES)
   public void runReplicationRandomWalkStep() throws Exception {
     var r = new org.apache.accumulo.testing.randomwalk.concurrent.Replication();