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

FilteredClassPathRunner should set the TCCL while creating the test class #7435

Closed
wilkinsona opened this issue Nov 21, 2016 · 0 comments
Closed
Assignees
Labels
type: enhancement A general enhancement type: task A general task
Milestone

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Nov 21, 2016

FilteredClassPathRunner doesn't set the TCCL when creating the test class. This means that the test class's fields are initialized while the TCCL is the app's class loader. This causes a problem with a field that's declared like this:

private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

The application context is left with its ClassLoader being the app class loader. It needs to be the filtered class loader otherwise class cast exceptions are likely to occur during test execution.

@wilkinsona wilkinsona added this to the 1.4.3 milestone Nov 21, 2016
@wilkinsona wilkinsona added the type: enhancement A general enhancement label Nov 21, 2016
@wilkinsona wilkinsona self-assigned this Nov 21, 2016
@wilkinsona wilkinsona added the type: task A general task label Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement type: task A general task
Projects
None yet
Development

No branches or pull requests

1 participant