maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tibor Digana (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (SUREFIRE-1647) When using junit5, delay loading testClass and use myown classLoader
Date Wed, 22 May 2019 14:35:00 GMT

     [ https://issues.apache.org/jira/browse/SUREFIRE-1647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tibor Digana closed SUREFIRE-1647.
----------------------------------
    Resolution: Done

https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=commit;h=75f87ee010cfc3c5835dcde18fe054c950d4df4b

> When using junit5, delay loading testClass and use myown classLoader 
> ---------------------------------------------------------------------
>
>                 Key: SUREFIRE-1647
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1647
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: JUnit 5.x support
>    Affects Versions: 2.22.1, 3.0.0-M2
>            Reporter: Shengli Cao
>            Assignee: Tibor Digana
>            Priority: Critical
>             Fix For: 3.0.0-M4
>
>
> org.junit.platform.engine.discovery.DiscoverySelectors#selectClass(java.lang.String)
and org.junit.platform.engine.discovery.DiscoverySelectors#selectClass(java.lang.Class<?>)
are different.
> If you use selectClass(java.lang.String) , it will load class by org.junit.platform.engine.discovery.ClassSelector#getJavaClass.
The code is as follow:
> {{public Class<?> getJavaClass() \{ if (this.javaClass == null) { this.javaClass
= ReflectionUtils.loadClass(this.className).orElseThrow( () -> new PreconditionViolationException("Could
not load class with name: " + this.className)); } return this.javaClass; } }}
> And the classloader fetched by {{Thread.currentThread().getContextClassLoader()}} will
load this class. In this way, it will delay  loading class 
> But selectClass(java.lang.Class<?>) will get class directly. 
>  
> In my situation, I need load Class by another classLoader so i need to delay loading
testClass.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message