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

Daniel Watford commented on OFBIZ-12722:
----------------------------------------

Resolving the deprecation of GroovyTestCase might be a bit complicated.

Groovy test suites test specifications are read in 
_ModelTestSuite#parseTestElements:_
{code:java}
} else if ("groovy-test-suite".equals(nodeName)) {
    try {
        Class<? extends TestCase> testClass =
                
UtilGenerics.cast(GroovyUtil.getScriptClassFromLocation(testElement.getAttribute("location")));
        this.testList.add(new TestSuite(testClass, 
testElement.getAttribute("name")));
    } catch (GeneralException e) {
        Debug.logError(e, MODULE);
    }
}  {code}
In the above code snippet, the groovy test class is read as a Class and then 
passed to the TestSuite constructor.

The TestSuite constructor will examine the class to identify test methods and 
add them to a list of tests to be executed as part of that suite. Tests methods 
are identified by checking the groovy class is assignable to 
junit.framework.Test and then finding all methods within the class that are 
public and have the prefix {_}test{_}.

Our groovy test classes extend GroovyScriptTestCase which, through its 
extension of GroovyTestCase, is an extension of junit.framework.Test.

If we change GroovyScriptTestCase to no longer extend GroovyTestCase, we will 
need to come up with a way to create Test or TestSuite objects in 
ModelTestSuite#parseTestElement for the groovy test class.

I don't have a solution for this yet.

 

> Fix Java 17 two warning issues
> ------------------------------
>
>                 Key: OFBIZ-12722
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12722
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: base, testtools
>    Affects Versions: Upcoming Branch
>            Reporter: Jacques Le Roux
>            Priority: Minor
>
> AuthHelper.java:132: warning: [removal] AccessController in java.security has 
> been deprecated and marked for removal
>         return AccessController.doPrivileged(
>                ^
> GroovyScriptTestCase.java:29: warning: [deprecation] GroovyTestCase in 
> groovy.util has been deprecated
> public class GroovyScriptTestCase extends GroovyTestCase {



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to