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

Make powermock compatible with JUnit 4.12 #8

Merged
merged 1 commit into from Dec 24, 2014

Conversation

henri-tremblay
Copy link
Contributor

Here is a basic fix to make powermock work with JUnit 4.12

johanhaleby added a commit that referenced this pull request Dec 24, 2014
Make powermock compatible with JUnit 4.12
@johanhaleby johanhaleby merged commit 84c2266 into powermock:master Dec 24, 2014
@johanhaleby
Copy link
Collaborator

Thanks a lot! Didn't know that JUnit 4.12 had been released yet.

@kcooney
Copy link

kcooney commented Jan 10, 2015

Hey, guys. I am one of the maintainers for JUnit. I was hunting around for things that might have broken by JUnit 4.13 and stumbled upon this pull.

Using reflection to access private fields of an internal class sounds fragile. If you have ideas for how we can create a supported API for whatever you are trying to do here, please file a feature request. Note that it's likely that MethodValidator (and JUnit4ClassRunner) will go away in JUnit 5.0, and there might not be a JUnit 4.13.

@johanhaleby
Copy link
Collaborator

Hi,

Yes it's extremely fragile. I would go as far to say that most of the PowerMock code base is very fragile and it's a nightmare to maintain unfortunately. To be honest it was such a long time ago since I created the Runner so I don't remember all the decisions of why things were done. But one of the things that makes the PowerMockRunner so complex is because something we refer to as "test chunking". What happens is that (potentially) each test method in a class can be executed by its own classloader and the result is merged together in the end. The way this works (if I remember things correctly) is that each of these test methods are actually executed as it's own "test class". To the user it looks like they are running the test class as normal but under the hood several test classes are executed and they report back to the original test class once they have completed to assemble the result. However this feature not only makes the code complex and brittle but it's also not used very often. I think the runner should be rewritten entirely and we should scrap the support for "test chunking". Probably should have been done a long time ago. I just need to find some time to do it :)

@kcooney
Copy link

kcooney commented Jan 10, 2015

Note that the replacement for JUnit4ClassRunner is BlockJUnit4ClassRunner

@johanhaleby
Copy link
Collaborator

Thanks for letting us know

@henri-tremblay henri-tremblay deleted the junit412 branch August 18, 2016 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants