Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a JUnit 5 equivalent of ModifiedClassPathRunner #16957

Closed
wilkinsona opened this issue May 24, 2019 · 4 comments
Closed

Provide a JUnit 5 equivalent of ModifiedClassPathRunner #16957

wilkinsona opened this issue May 24, 2019 · 4 comments
Assignees
Labels
status: superseded An issue that has been superseded by another type: task A general task

Comments

@wilkinsona
Copy link
Member

We need this as part of completing our migration to JUnit 5. Unfortunately, it isn't possible at the moment. junit-team/junit5#201 is required and there may be some other changes that are needed as well.

@wilkinsona wilkinsona added this to the 2.2.x milestone May 24, 2019
@wilkinsona wilkinsona added status: blocked An issue that's blocked on an external project change type: task A general task labels May 24, 2019
@wilkinsona wilkinsona self-assigned this May 24, 2019
@sbrannen
Copy link
Member

sbrannen commented Jun 3, 2019

@wilkinsona, the new InvocationInterceptor extension API coming in JUnit Jupiter 5.5 may actually be sufficient to port the functionality of ModifiedClassPathRunner to JUnit Jupiter.

Since JUnit Jupiter 5.5 will most likely be released in time for inclusion in Spring Boot 2.2, you may wish to give the porting a shot now with 5.5 snapshots or the upcoming 5.5 RC1.

If you need any assistance, just let me know.

/cc @marcphilipp

@wilkinsona
Copy link
Member Author

Thanks for the pointer, @sbrannen. Reading through the commit that introduced the new extension point, I'm struggling to see how it will help with implementing a ModifiedClassPathRunner replacement.

A replacement for ModifiedClassPathRunner requires the ability to load the test class using a custom class loader. I can't see how that can be achieved with the interception points that are offered and the requirement to always call proceed on the given Invocation. For example, even without the proceed requirement, the signature of interceptTestClassConstructor seems to prevents me from loading the test class using a new class loader and returning an instance of it.

What have I missed?

@sbrannen
Copy link
Member

sbrannen commented Jun 4, 2019

What have I missed?

I don't think you overlooked anything.

I overlooked the fact that ModifiedClassPathTestClass loads the actual test class by name via the custom ClassLoader:

At a first pass through the code (viewing it in the browser), it appeared that only the TCCL was being set and reset, which should be achieveable via the new interceptor extension API.

Sorry for the confusion.

You'll indeed have to wait for custom ClassLoader support in JUnit Jupiter in order to implement a ModifiedClassPathRunner replacement.

@wilkinsona
Copy link
Member Author

Closing in favour of #17491.

@wilkinsona wilkinsona removed this from the 2.2.x milestone Jul 12, 2019
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants