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

emilles 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 f105fc3  minor refactor
f105fc3 is described below

commit f105fc3b44f329d444b2c9db8775499329958329
Author: Eric Milles <[email protected]>
AuthorDate: Fri Oct 18 10:21:50 2019 -0500

    minor refactor
---
 src/test/groovy/bugs/Groovy9261.groovy             | 37 ++++++++++++++--------
 .../test/suite/ATestScriptThatsNoTestCase.groovy   |  4 ++-
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/test/groovy/bugs/Groovy9261.groovy 
b/src/test/groovy/bugs/Groovy9261.groovy
index 347d5c7..1581eb9 100644
--- a/src/test/groovy/bugs/Groovy9261.groovy
+++ b/src/test/groovy/bugs/Groovy9261.groovy
@@ -18,11 +18,17 @@
  */
 package groovy.bugs
 
-import groovy.test.GroovyTestCase
+import groovy.transform.CompileStatic
+import org.junit.Test
 
-class Groovy9261 extends GroovyTestCase {
+import static groovy.test.GroovyAssert.shouldFail
+
+@CompileStatic
+final class Groovy9261 {
+
+    @Test
     void testInvalidResourceInARM() {
-        String errMsg = shouldFail '''\
+        def err = shouldFail '''\
             @groovy.transform.CompileStatic
             void test() {
                 try (String str = '123') {
@@ -31,12 +37,13 @@ class Groovy9261 extends GroovyTestCase {
             test()
         '''
 
-        assert errMsg.contains('Resource[java.lang.String] in ARM should be of 
type AutoCloseable')
-        assert errMsg.contains('@ line 3, column 22.')
+        assert err.message.contains('Resource[java.lang.String] in ARM should 
be of type AutoCloseable')
+        assert err.message.contains('@ line 3, column 22.')
     }
 
+    @Test
     void testInvalidResourceInARM2() {
-        String errMsg = shouldFail '''\
+        def err = shouldFail '''\
             @groovy.transform.CompileStatic
             void test() {
                 try (str = '123') {
@@ -45,12 +52,13 @@ class Groovy9261 extends GroovyTestCase {
             test()
         '''
 
-        assert errMsg.contains('Resource[java.lang.String] in ARM should be of 
type AutoCloseable')
-        assert errMsg.contains('@ line 3, column 22.')
+        assert err.message.contains('Resource[java.lang.String] in ARM should 
be of type AutoCloseable')
+        assert err.message.contains('@ line 3, column 22.')
     }
 
+    @Test
     void testInvalidResourceInARM3() {
-        String errMsg = shouldFail '''\
+        def err = shouldFail '''\
             @groovy.transform.CompileStatic
             void test() {
                 try (def sr = new StringReader(''); str = '123') {
@@ -59,12 +67,13 @@ class Groovy9261 extends GroovyTestCase {
             test()
         '''
 
-        assert errMsg.contains('Resource[java.lang.String] in ARM should be of 
type AutoCloseable')
-        assert errMsg.contains('@ line 3, column 53.')
+        assert err.message.contains('Resource[java.lang.String] in ARM should 
be of type AutoCloseable')
+        assert err.message.contains('@ line 3, column 53.')
     }
 
+    @Test
     void testInvalidResourceInEnhancedARM() {
-        String errMsg = shouldFail '''\
+        def err = shouldFail '''\
             @groovy.transform.CompileStatic
             void test() {
                 String str = '123'
@@ -74,7 +83,7 @@ class Groovy9261 extends GroovyTestCase {
             test()
         '''
 
-        assert errMsg.contains('Resource[java.lang.String] in ARM should be of 
type AutoCloseable')
-        assert errMsg.contains('@ line 4, column 22.')
+        assert err.message.contains('Resource[java.lang.String] in ARM should 
be of type AutoCloseable')
+        assert err.message.contains('@ line 4, column 22.')
     }
 }
diff --git 
a/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy
 
b/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy
index 733a0d6..bc73469 100644
--- 
a/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy
+++ 
b/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy
@@ -16,5 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
+package groovy.test.suite
+
 // used for testing ScriptTestCaseAdapter usage with AllTestSuite
-assert true
\ No newline at end of file
+assert true

Reply via email to