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

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


The following commit(s) were added to refs/heads/master by this push:
     new fade856fe6 [ZEPPELIN-5958] Migrate shell to JUnit5 (#4653)
fade856fe6 is described below

commit fade856fe62ca2e41fd26d3253e082579ba2c2db
Author: Philipp Dallig <philipp.dal...@gmail.com>
AuthorDate: Wed Sep 13 14:54:49 2023 +0200

    [ZEPPELIN-5958] Migrate shell to JUnit5 (#4653)
---
 .../apache/zeppelin/shell/BaseInterpreterTest.java |  8 +++----
 .../zeppelin/shell/ShellInterpreterTest.java       | 25 +++++++++++-----------
 .../zeppelin/shell/TerminalInterpreterTest.java    | 19 ++++++++++------
 3 files changed, 28 insertions(+), 24 deletions(-)

diff --git 
a/shell/src/test/java/org/apache/zeppelin/shell/BaseInterpreterTest.java 
b/shell/src/test/java/org/apache/zeppelin/shell/BaseInterpreterTest.java
index a8997e3a91..35b6934ec1 100644
--- a/shell/src/test/java/org/apache/zeppelin/shell/BaseInterpreterTest.java
+++ b/shell/src/test/java/org/apache/zeppelin/shell/BaseInterpreterTest.java
@@ -25,8 +25,8 @@ import org.apache.zeppelin.interpreter.InterpreterException;
 import org.apache.zeppelin.interpreter.InterpreterOutput;
 import org.apache.zeppelin.interpreter.remote.RemoteInterpreterEventClient;
 import org.apache.zeppelin.user.AuthenticationInfo;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -34,10 +34,10 @@ import static org.mockito.Mockito.mock;
 
 public abstract class BaseInterpreterTest {
 
-  @Before
+  @BeforeEach
   public abstract void setUp() throws InterpreterException;
 
-  @After
+  @AfterEach
   public abstract void tearDown() throws InterpreterException;
 
   protected InterpreterContext getIntpContext() {
diff --git 
a/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java 
b/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
index ddaf0dbfb4..9692321539 100644
--- a/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
+++ b/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
@@ -17,28 +17,27 @@
 
 package org.apache.zeppelin.shell;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.zeppelin.interpreter.InterpreterException;
 import org.apache.zeppelin.interpreter.InterpreterOutput;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
 import java.util.Properties;
 
 import org.apache.zeppelin.interpreter.InterpreterContext;
 import org.apache.zeppelin.interpreter.InterpreterResult;
 import org.apache.zeppelin.interpreter.InterpreterResult.Code;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class ShellInterpreterTest {
+class ShellInterpreterTest {
 
   private ShellInterpreter shell;
   private InterpreterContext context;
   private InterpreterResult result;
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     Properties p = new Properties();
     p.setProperty("shell.command.timeout.millisecs", "5000");
@@ -50,12 +49,12 @@ public class ShellInterpreterTest {
     shell.open();
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
   }
 
   @Test
-  public void test() throws InterpreterException {
+  void test() throws InterpreterException {
     if (System.getProperty("os.name").startsWith("Windows")) {
       result = shell.interpret("dir", context);
     } else {
@@ -69,7 +68,7 @@ public class ShellInterpreterTest {
   }
 
   @Test
-  public void testInvalidCommand() throws InterpreterException {
+  void testInvalidCommand() throws InterpreterException {
     if (System.getProperty("os.name").startsWith("Windows")) {
       result = shell.interpret("invalid_command\ndir", context);
     } else {
@@ -80,7 +79,7 @@ public class ShellInterpreterTest {
   }
 
   @Test
-  public void testShellTimeout() throws InterpreterException {
+  void testShellTimeout() throws InterpreterException {
     if (System.getProperty("os.name").startsWith("Windows")) {
       result = shell.interpret("timeout 8", context);
     } else {
@@ -92,7 +91,7 @@ public class ShellInterpreterTest {
   }
 
   @Test
-  public void testShellTimeout2() throws InterpreterException {
+  void testShellTimeout2() throws InterpreterException {
     context = InterpreterContext.builder()
             .setParagraphId("paragraphId")
             .setInterpreterOut(new InterpreterOutput())
diff --git 
a/shell/src/test/java/org/apache/zeppelin/shell/TerminalInterpreterTest.java 
b/shell/src/test/java/org/apache/zeppelin/shell/TerminalInterpreterTest.java
index ac9a3f5345..6365a0a4ae 100644
--- a/shell/src/test/java/org/apache/zeppelin/shell/TerminalInterpreterTest.java
+++ b/shell/src/test/java/org/apache/zeppelin/shell/TerminalInterpreterTest.java
@@ -22,7 +22,9 @@ import org.apache.zeppelin.interpreter.InterpreterException;
 import org.apache.zeppelin.interpreter.InterpreterResult;
 import org.apache.zeppelin.shell.terminal.TerminalSocketTest;
 import org.eclipse.jetty.util.component.LifeCycle;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,15 +32,16 @@ import javax.websocket.ContainerProvider;
 import javax.websocket.DeploymentException;
 import javax.websocket.Session;
 import javax.websocket.WebSocketContainer;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 import java.io.IOException;
 import java.net.URI;
 import java.util.Properties;
 import java.util.regex.Pattern;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class TerminalInterpreterTest extends BaseInterpreterTest {
+class TerminalInterpreterTest extends BaseInterpreterTest {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(TerminalInterpreterTest.class);
 
   private TerminalInterpreter terminal;
@@ -46,6 +49,7 @@ public class TerminalInterpreterTest extends 
BaseInterpreterTest {
   private InterpreterResult result;
 
   @Override
+  @BeforeEach
   public void setUp() throws InterpreterException {
     Properties p = new Properties();
     intpContext = getIntpContext();
@@ -62,12 +66,13 @@ public class TerminalInterpreterTest extends 
BaseInterpreterTest {
   }
 
   @Override
+  @AfterEach
   public void tearDown() throws InterpreterException {
     terminal.close();
   }
 
   @Test
-  public void testInvalidCommand() {
+  void testInvalidCommand() {
     Session session = null;
     WebSocketContainer webSocketContainer = null;
 
@@ -147,7 +152,7 @@ public class TerminalInterpreterTest extends 
BaseInterpreterTest {
   }
 
   @Test
-  public void testValidCommand() {
+  void testValidCommand() {
     Session session = null;
     WebSocketContainer webSocketContainer = null;
 

Reply via email to