-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
InstancePostProcessor should return test instance #203
Comments
I don't think it is a wise idea to repurpose For example, let's assume we have two registered extensions that implement If At the very least, there is an issue with regard to ordering of such extensions, but I would argue that is only an indicator of the true problem: When does it ever make sense for more than one extension to replace the test instance? In my opinion, the answer to the above question is never. With that in mind, I would propose a new extension -- call it |
Of course, the potential problem I outlined above does not come into effect if instances of |
For PowerMock main goal- it's to be able to load test class and all other classes with PowerMock class loader. Approach with But, it also could be a point of fail, for example assertion exception or any other exception witch test could throw and jUnit engine is expected. In this class casting issues moved forward. I mean that trying to cast exception to expected class could throw `ClassCastException' or instanceOf would return incorrect result. |
@sbrannen It's impossible to enforce wrapping, or is it. It might not even be practical for PowerMock's purposes when using a different class loader to create basically the same object. |
In my Showcase I got another Problem. Playing around with class loader results in other extensions not working as expected. Actually I do not know much about the powermock internals. Maybe this problem can be solved to let the powermock class loader ignore the packages of other extensions. I already added mockito for ignore: https://github.com/mepeisen/xw-nukkit-test/blob/master/src/main/java/eu/xworlds/nukkit/test/NukkitExtension.java#L63 and I do not know why i have to do this manually :-) |
@sbrannen I currently prefer a new extension point. Although I'm not sure it will really solve PowerMock's needs (see discussion in #201). What we would need then, is a way to have different ordering and uniqueness constraints per extension point type (e.g. "There must be only one test instance factory"). I already implemented something like that in PR #135. |
@mepeisen Yes, that's the can of worms I was talking about :-/ |
I'm closing this issue because this would not solve PowerMock's problem (as discussed in #201). |
This seems to be necessary for PowerMock extension (see #201).
@junit-team Any objections?
The text was updated successfully, but these errors were encountered: