瀏覽代碼

ZOOKEEPER-3852: Upgrade jUnit in ZooKeeper-Jute

Sub-task of ZOOKEEPER-3732, updating jUnit to 5.6.2 in zookeeper-it sub-component.

Change-Id: I495a1516c07bc597558719030a0d585bc7d4f7eb

Author: Tamas Penzes <tamaas@cloudera.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Norbert Kalmar <nkalmar@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes #1386 from tamaashu/ZOOKEEPER-3852
Tamas Penzes 4 年之前
父節點
當前提交
6ab1822ec4

+ 2 - 2
zookeeper-jute/pom.xml

@@ -37,8 +37,8 @@
       <artifactId>audience-annotations</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>

+ 10 - 10
zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java

@@ -18,17 +18,17 @@
 
 package org.apache.jute;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 // TODO: introduce JuteTestCase as in ZKTestCase
 
@@ -47,8 +47,8 @@ public class BinaryInputArchiveTest {
             ia.readString("");
             fail("Should have thrown an IOException");
         } catch (IOException e) {
-            assertTrue("Not 'Unreasonable length' exception: " + e,
-                    e.getMessage().startsWith(BinaryInputArchive.UNREASONBLE_LENGTH));
+            assertTrue(e.getMessage().startsWith(BinaryInputArchive.UNREASONBLE_LENGTH),
+                    () -> "Not 'Unreasonable length' exception: " + e);
         }
     }
 
@@ -155,8 +155,8 @@ public class BinaryInputArchiveTest {
       ia.readString("");
       fail("Should have thrown an IOException");
     } catch (IOException e) {
-      assertTrue("Not 'Unreasonable length' exception: " + e,
-          e.getMessage().startsWith(BinaryInputArchive.UNREASONBLE_LENGTH));
+      assertTrue(e.getMessage().startsWith(BinaryInputArchive.UNREASONBLE_LENGTH),
+              () -> "Not 'Unreasonable length' exception: " + e);
     }
   }
 

+ 1 - 1
zookeeper-jute/src/test/java/org/apache/jute/TestCheckWriterReader.java

@@ -18,7 +18,7 @@
 
 package org.apache.jute;
 
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;