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

uwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 18b3fc1  ARROW-4740: [Java] Upgrade to JUnit 5.
18b3fc1 is described below

commit 18b3fc196fd981ad477bf57b19d0d7723769ae93
Author: Micah Kornfield <emkornfi...@gmail.com>
AuthorDate: Mon Mar 18 11:19:37 2019 +0100

    ARROW-4740: [Java] Upgrade to JUnit 5.
    
    - Followed recommended POM Recipes from web.
    - Remove POM references that no longer seem valid (and update others test 
related packages to be there latest).
    - Modified TestAuth.java to demonstrate new exception assertions.
    
    Author: Micah Kornfield <emkornfi...@gmail.com>
    
    Closes #3955 from emkornfield/upgrade_junit and squashes the following 
commits:
    
    d8d8a5ec <Micah Kornfield> ARROW-4740:  Upgrade to JUnit 5.
---
 java/adapter/jdbc/pom.xml                          |  8 ----
 .../org/apache/arrow/flight/auth/TestAuth.java     | 25 +++++++------
 java/gandiva/pom.xml                               |  6 ---
 java/pom.xml                                       | 43 ++++++++++++++--------
 4 files changed, 42 insertions(+), 40 deletions(-)

diff --git a/java/adapter/jdbc/pom.xml b/java/adapter/jdbc/pom.xml
index dc91950..7915bb6 100644
--- a/java/adapter/jdbc/pom.xml
+++ b/java/adapter/jdbc/pom.xml
@@ -46,14 +46,6 @@
             <version>${dep.guava.version}</version>
         </dependency>
 
-        <!-- Test -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>${dep.junit.version}</version>
-            <scope>test</scope>
-        </dependency>
-
         <!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
         <dependency>
             <groupId>com.h2database</groupId>
diff --git 
a/java/flight/src/test/java/org/apache/arrow/flight/auth/TestAuth.java 
b/java/flight/src/test/java/org/apache/arrow/flight/auth/TestAuth.java
index 384190f..20a2814 100644
--- a/java/flight/src/test/java/org/apache/arrow/flight/auth/TestAuth.java
+++ b/java/flight/src/test/java/org/apache/arrow/flight/auth/TestAuth.java
@@ -17,6 +17,8 @@
 
 package org.apache.arrow.flight.auth;
 
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 import java.io.IOException;
 import java.util.Arrays;
 
@@ -33,16 +35,14 @@ import org.apache.arrow.util.AutoCloseables;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.ExpectedException;
 
 import com.google.common.collect.ImmutableList;
 
-public class TestAuth {
+import io.grpc.StatusRuntimeException;
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
+public class TestAuth {
+  final String PERMISSION_DENIED = "PERMISSION_DENIED";
 
   private static final String USERNAME = "flight";
   private static final String PASSWORD = "woohoo";
@@ -62,17 +62,20 @@ public class TestAuth {
   @Test
   public void invalidAuth() {
 
-    thrown.expectMessage("PERMISSION_DENIED");
-    client.authenticateBasic(USERNAME, "WRONG");
+    assertThrows(StatusRuntimeException.class, () -> {
+      client.authenticateBasic(USERNAME, "WRONG");
+    }, PERMISSION_DENIED);
 
-    thrown.expectMessage("PERMISSION_DENIED");
-    client.listFlights(Criteria.ALL);
+    assertThrows(StatusRuntimeException.class, () -> {
+      client.listFlights(Criteria.ALL);
+    }, PERMISSION_DENIED);
   }
 
   @Test
   public void didntAuth() {
-    thrown.expectMessage("PERMISSION_DENIED");
-    client.listFlights(Criteria.ALL);
+    assertThrows(StatusRuntimeException.class, () -> {
+      client.listFlights(Criteria.ALL);
+    }, PERMISSION_DENIED);
   }
 
   @Before
diff --git a/java/gandiva/pom.xml b/java/gandiva/pom.xml
index ded334c..c0addcb 100644
--- a/java/gandiva/pom.xml
+++ b/java/gandiva/pom.xml
@@ -48,12 +48,6 @@
             <version>${protobuf.version}</version>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
             <version>23.0</version>
diff --git a/java/pom.xml b/java/pom.xml
index 076f642..17f91bd 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -29,7 +29,8 @@
 
   <properties>
     
<target.gen.source.path>${project.basedir}/target/generated-sources</target.gen.source.path>
-    <dep.junit.version>4.11</dep.junit.version>
+    <dep.junit.platform.version>1.4.0</dep.junit.platform.version>
+    <dep.junit.jupiter.version>5.4.0</dep.junit.jupiter.version>
     <dep.slf4j.version>1.7.25</dep.slf4j.version>
     <dep.guava.version>20.0</dep.guava.version>
     <dep.netty.version>4.1.22.Final</dep.netty.version>
@@ -565,31 +566,43 @@
       <scope>test</scope>
     </dependency>
 
+
+    <dependency>
+      <groupId>org.junit.platform</groupId>
+      <artifactId>junit-platform-runner</artifactId>
+      <version>${dep.junit.platform.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>${dep.junit.jupiter.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <version>${dep.junit.jupiter.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
-      <!-- JMockit needs to be on class path before JUnit. -->
-      <groupId>org.jmockit</groupId>
-      <artifactId>jmockit</artifactId>
-      <version>1.33</version>
+      <groupId>org.junit.vintage</groupId>
+      <artifactId>junit-vintage-engine</artifactId>
+      <version>${dep.junit.jupiter.version}</version>
       <scope>test</scope>
     </dependency>
+    <!-- Use to keep older tests running -->
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>${dep.junit.version}</version>
+      <version>4.12</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <version>2.7.22</version>
+      <artifactId>mockito-junit-jupiter</artifactId>
+      <version>2.25.1</version>
       <scope>test</scope>
-      <!-- Mockito  contains old Hamcrest classes, causes issues with JUNIT -->
-      <exclusions>
-        <exclusion>
-         <groupId>org.hamcrest</groupId>
-          <artifactId>hamcrest-core</artifactId>
-       </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
       <groupId>ch.qos.logback</groupId>

Reply via email to