Skip to content

Introduce extension API for providing a custom ClassLoader (e.g., for Powermock) #201

Closed

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions