Description
openedon Mar 13, 2016
Overview
I tried to build a Powermock Extension
similar to the Mockito example. I have to test some classes that create new objects within their constructors. In JUnit 4 I simply use the PowerkmockRunner
and the whenNew
from Powermock.
At least I ended with many problems and gave up. However in JUnit 4 Powermock creates an instrumented class loader and even duplicates everything (the test instance etc.) by using the new class loader. It is simple because the loader/rule are aware of executing the test itself. In JUnit Jupiter an Extension
is not able to execute the test by itself.
I am wondering how this will be done in JUnit Jupiter. Are you planning to introduce some CreateTestInstance
extension API? Something that is aware of manipulating class loaders. Or at least an AroundAll
extension API to instrument the whole test class?
Related Issues
- Introduce extension API for executing test in user-defined thread #157
- TestEngines not found by ServiceLoader on Java 9 #805
- Revise ClassLoader lookups across the platform #806
- Catch up on JUnit 4 Runner support for custom ClassLoaders #1680
- Thread context classloader should be reset after each test #1799