You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/04/16 09:24:19 UTC

(groovy) branch master updated: minor refactor: junit5 for groovy-groovysh

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ef61daf254 minor refactor: junit5 for groovy-groovysh
ef61daf254 is described below

commit ef61daf254b5083192d70dd6505634889079c116
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Apr 16 19:24:09 2026 +1000

    minor refactor: junit5 for groovy-groovysh
---
 .../groovy/org/apache/groovy/groovysh/commands/AliasTest.groovy  | 3 +++
 .../groovy/org/apache/groovy/groovysh/commands/ImportTest.groovy | 9 +++++++++
 .../org/apache/groovy/groovysh/commands/MethodsTest.groovy       | 3 +++
 .../groovy/org/apache/groovy/groovysh/commands/PrntTest.groovy   | 3 +++
 .../groovy/org/apache/groovy/groovysh/commands/ShowTest.groovy   | 3 +++
 .../org/apache/groovy/groovysh/commands/SystemTestSupport.groovy | 3 +++
 .../groovy/org/apache/groovy/groovysh/commands/TypesTest.groovy  | 3 +++
 7 files changed, 27 insertions(+)

diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/AliasTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/AliasTest.groovy
index 7cdc47888c..c4a84c0ae9 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/AliasTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/AliasTest.groovy
@@ -18,11 +18,14 @@
  */
 package org.apache.groovy.groovysh.commands
 
+import org.junit.jupiter.api.Test
+
 /**
  * Tests for the {@code /alias} command.
  */
 class AliasTest extends ConsoleTestSupport {
 
+    @Test
     void testAliasAndUnalias() {
         assert !console.hasAlias('foo')
         console.invoke(session, '/alias', 'foo', '/history')
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ImportTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ImportTest.groovy
index 5ba1180a33..241fe3d142 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ImportTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ImportTest.groovy
@@ -18,10 +18,13 @@
  */
 package org.apache.groovy.groovysh.commands
 
+import org.junit.jupiter.api.Test
+
 /**
  * Tests for the {@code /imports} command.
  */
 class ImportTest extends SystemTestSupport {
+    @Test
     void testImport() {
         system.execute('/imports')
         assert !printer.output.join().contains('import java.awt.TextField')
@@ -29,4 +32,10 @@ class ImportTest extends SystemTestSupport {
         system.execute('/imports')
         assert printer.output.join().contains('import java.awt.TextField')
     }
+
+    @Test
+    void testModuleImport() {
+//        system.execute('import module java.sql')
+//        system.execute('assert Connection.name == "java.sql.Connection"')
+    }
 }
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/MethodsTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/MethodsTest.groovy
index 59cfb70a95..08977f9159 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/MethodsTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/MethodsTest.groovy
@@ -18,10 +18,13 @@
  */
 package org.apache.groovy.groovysh.commands
 
+import org.junit.jupiter.api.Test
+
 /**
  * Tests for the {@code /methods} command.
  */
 class MethodsTest extends SystemTestSupport {
+    @Test
     void testImport() {
         system.execute('/methods')
         assert !printer.output.join().contains('twice')
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/PrntTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/PrntTest.groovy
index 7c66747669..5e24a3d177 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/PrntTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/PrntTest.groovy
@@ -18,10 +18,13 @@
  */
 package org.apache.groovy.groovysh.commands
 
+import org.junit.jupiter.api.Test
+
 /**
  * Tests for the /prnt command.
  */
 class PrntTest extends SystemTestSupport {
+    @Test
     void testPrntVariable() {
         assert !console.hasVariable('foo')
         console.execute('dummyName', "foo = 'bar'")
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ShowTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ShowTest.groovy
index 93f83d1a24..489492e445 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ShowTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/ShowTest.groovy
@@ -18,10 +18,13 @@
  */
 package org.apache.groovy.groovysh.commands
 
+import org.junit.jupiter.api.Test
+
 /**
  * Tests for the /show command.
  */
 class ShowTest extends ConsoleTestSupport {
+    @Test
     void testShowVariable() {
         assert !console.hasVariable('foo')
         console.execute('dummyName', "foo = 'bar'")
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
index 7a5934b470..e9bd2a8215 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
@@ -22,6 +22,8 @@ import org.apache.groovy.groovysh.jline.GroovySystemRegistry
 import org.jline.terminal.Terminal
 import org.jline.terminal.TerminalBuilder
 
+import org.junit.jupiter.api.BeforeEach
+
 import java.util.function.Supplier
 
 /**
@@ -31,6 +33,7 @@ abstract class SystemTestSupport extends ConsoleTestSupport {
 
     protected GroovySystemRegistry system
 
+    @BeforeEach
     @Override
     void setUp() {
         super.setUp()
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/TypesTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/TypesTest.groovy
index b740a9e232..8080b4f3d2 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/TypesTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/TypesTest.groovy
@@ -18,10 +18,13 @@
  */
 package org.apache.groovy.groovysh.commands
 
+import org.junit.jupiter.api.Test
+
 /**
  * Tests for the {@code /types} command.
  */
 class TypesTest extends SystemTestSupport {
+    @Test
     void testImport() {
         def names = ['C', 'I', 'T', 'R', 'E', 'A']
         system.execute('/types')