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 2020/01/25 14:07:48 UTC

[groovy] branch GROOVY_3_0_X updated: fix test impacted by coverage instrumentation

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

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 07a7a27  fix test impacted by coverage instrumentation
07a7a27 is described below

commit 07a7a27def05cdf61f4e99d52fdfc3af6b64180c
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Jan 26 00:07:35 2020 +1000

    fix test impacted by coverage instrumentation
---
 .../org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy b/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
index 539ebbb..04affc0 100644
--- a/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
@@ -27,6 +27,8 @@ import org.junit.rules.TestName
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
 
+import java.lang.reflect.Method
+
 /**
  * Tests for the @Generated annotation.
  */
@@ -53,7 +55,7 @@ class GeneratedAnnotationTest extends GroovyShellTestCase {
             new Person()
         ''')
 
-        GroovyObject.declaredMethods.each { m ->
+        GroovyObject.declaredMethods.findAll{ !isCoverageInstrumentationMethod(it) }.each { m ->
             def method = person.class.declaredMethods.find { it.name == m.name }
             if (method) {
                 assert method.annotations*.annotationType().name.contains('groovy.transform.Generated')
@@ -61,6 +63,10 @@ class GeneratedAnnotationTest extends GroovyShellTestCase {
         }
     }
 
+    private static boolean isCoverageInstrumentationMethod(Method it) {
+        it.name.contains('jacoco')
+    }
+
     @Test
     void testDefaultConstructorIsAnnotatedWithGenerated_GROOVY9051() {
         def person = evaluate('''