[ 
https://issues.apache.org/jira/browse/GROOVY-9705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17187074#comment-17187074
 ] 

Chiang Seng Chang commented on GROOVY-9705:
-------------------------------------------

Found a workaround by filtering:

{{build.gradle.kts}}
plugins \{
    groovy
}
repositories \{
    jcenter()
}
dependencies \{
    implementation("org.codehaus.groovy:groovy-all:3.0.5") {
        exclude(group = "org.testng")
    }
    testImplementation("org.testng:testng:7.3.0")
}
tasks.test {
    useTestNG()
    *filter \{
        excludeTestsMatching("*.setMetaClass")
        excludeTestsMatching("*.setProperty")
    }*
}

> Groovy 3.0.5 Unit Test Class: TestNGException at Parameters.java:437
> --------------------------------------------------------------------
>
>                 Key: GROOVY-9705
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9705
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.5
>         Environment: Java version AdoptOpenJDK (build 25.262-b10, mixed mode)
> Gradle version 6.6.1
> Groovy version 3.0.5
> TestNG version 7.3.0
>            Reporter: Chiang Seng Chang
>            Priority: Major
>         Attachments: g3tng.tar.gz
>
>
> TestNG selects setMetaClass() and setProperty() as test methods.
> {{org.testng.TestNGException:
> Cannot inject @Test annotated Method [setMetaClass] with [interface 
> groovy.lang.MetaClass].}}
> {{org.testng.TestNGException:
> Cannot inject @Test annotated Method [setProperty] with [class 
> java.lang.String, class java.lang.Object].}}
> Does not happen using groovy 2.x
> Attached a simple gradle project, run gradlew test to get the exceptions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to