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 2019/04/30 08:02:20 UTC

[groovy] 01/02: test refactor

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

commit 30690ab48705cb5c4a7a96a6801af3e8fb8edd2a
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Apr 30 16:57:51 2019 +1000

    test refactor
---
 .../methods}/RepetitiveMethodTest.groovy           | 26 +++++++++++++---------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/test/gls/ch08/s04/RepetitiveMethodTest.groovy b/src/test/gls/classes/methods/RepetitiveMethodTest.groovy
similarity index 73%
rename from src/test/gls/ch08/s04/RepetitiveMethodTest.groovy
rename to src/test/gls/classes/methods/RepetitiveMethodTest.groovy
index a583f3e..b724e2d 100644
--- a/src/test/gls/ch08/s04/RepetitiveMethodTest.groovy
+++ b/src/test/gls/classes/methods/RepetitiveMethodTest.groovy
@@ -16,30 +16,36 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package gls.ch08.s04
+package gls.classes.methods
 
 import gls.CompilableTestSupport
 
 class RepetitiveMethodTest extends CompilableTestSupport {
 
     void testRepetitiveMethod() {
-        def text = """
+        def message = shouldNotCompile('''
             class A  {
                 void foo() {}
                 void foo() {}
             }
-        """
-        shouldNotCompile(text)
+        ''')
+        assert message.contains('duplicates another method of the same signature')
     }
 
-    void testRepetitiveMethodsCreationForBooleanProperties() {
-        shouldCompile """
-            class BoolTest {
+    void testRepetitiveMethodsAllowedForProperties() {
+        shouldCompile '''
+            class PropertyOverride {
                 boolean success
+                int num
+
                 boolean isSuccess() {
-                    return success
+                    success
+                }
+
+                int getNum() {
+                    num
                 }
             }
-        """
+        '''
     }
-}
\ No newline at end of file
+}