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
Optional replacement of MockClassLoader.class.getClassLoader() via Annotation. #823
Comments
|
thank you for willing to contribute to PowerMock. I think, it could be really useful if your changes could resolve OSGI issues. I think, better to create a pull request and then discuss changes. I also want to bring your notice on |
…etClassLoader() via Annotation.
…etClassLoader() via Annotation.
…etClassLoader() via Annotation. (Fix JUnit)
…etClassLoader() via Annotation. (Fix JUnit)
…etClassLoader() via Annotation. (Fix JUnit)
|
Hi,
Thanks , I created a pull request with the changes, but I haven't had a
look in powermock-byte-buddy branch yet, But tomorrow I will have a look on
it.
Looking forward to your comments, regarding my pull request. Thanks once
more.
Greets
Nicole
2017-07-30 20:13 GMT+02:00 Arthur Zagretdinov <notifications@github.com>:
… thank you for willing to contribute to PowerMock. I think, it could be
really useful if your changes could resolve OSGI issues. I think, better to
create a pull request and then discuss changes.
I also want to bring your notice on powermock-byte-buddy branch where
I've refactored MockClassLoader and started implementing ability to specify
class loader in PrepareForTest annotation. This feature is required
because I'm going to provide ability using ClassLoader that uses ByteBuddy
for byte-code modification as experimental support at first. Maybe your
changes could integrated with this changes?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#823 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFg6z34i60lCIjNX76bQ_h_ZzLHFtVDRks5sTMe5gaJpZM4Omhcw>
.
|
|
Hi Arthur,
I had a look on the powermock-byte-buddy branch and I saw the refactored
MockClassLoader but not the ability to specifiy the classloader in
PrepareForTest annotation. The classloader I need to set to get OSGI
running is the deferTo of the DeferSupportingClassLoader. By now this is
set fix to MockClassLoader.class.getClassLoader(). If this will be the
classloader you will modify too via the PrepareForTest annotation, for me
it would be ok to use the PrepareForTest annotation to specify the
classloader. But yeah, I think it would be great to synch here with you
about a common approach.
Greets
Nicole
2017-07-30 23:02 GMT+02:00 Nicole Behlen <nicole.behlen@gmail.com>:
… Hi,
Thanks , I created a pull request with the changes, but I haven't had a
look in powermock-byte-buddy branch yet, But tomorrow I will have a look on
it.
Looking forward to your comments, regarding my pull request. Thanks once
more.
Greets
Nicole
2017-07-30 20:13 GMT+02:00 Arthur Zagretdinov ***@***.***>:
> thank you for willing to contribute to PowerMock. I think, it could be
> really useful if your changes could resolve OSGI issues. I think, better to
> create a pull request and then discuss changes.
>
> I also want to bring your notice on powermock-byte-buddy branch where
> I've refactored MockClassLoader and started implementing ability to specify
> class loader in PrepareForTest annotation. This feature is required
> because I'm going to provide ability using ClassLoader that uses ByteBuddy
> for byte-code modification as experimental support at first. Maybe your
> changes could integrated with this changes?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#823 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFg6z34i60lCIjNX76bQ_h_ZzLHFtVDRks5sTMe5gaJpZM4Omhcw>
> .
>
|
|
This would also solve problems the SAP hybris platform (https://hybris.com/) has with unit testing and powermock. There some of the unit tests for web components are loaded using a classloader, but the powermock classes are being loaded with the parent of that classloader. Then |
|
I'd like to add a comment on this as well. We are working with Hybris Platform 1811 and we exactly had the problems Andreas described in the comment above. The unit tests for web components were failing because the test classes couldn't be found (using the standard Mock Classloader) |
|
Hi @qupera ! I am currently facing similar issues with the class loader used in PowerMock tests for Hybris web components. Could you share what have you done to solve the issue? |
We were using PowerMock 1.5.6 under Eclipse Mars for Junit tests.
With our migration to Eclipse Oxygen we also wanted to update PowerMock to 1.7, but we noticed, that there is no longer any support for OSGI, due to the classloading problems using PowerMock/OSGI.
As we have hundreds of test-cases using the PowerMockRunner, and we do not want to lose those testcases, and we do not have the time to redesign our code and junit tests. We modified the PowerMock sources, integrating some additional annotations to provide optionally some own class loader, instead of MockClassLoader.class.getClassLoader().
Right now, this is working fine for our hundreds of test-cases and we would like to contribute the changes to the next PowerMock release.
The text was updated successfully, but these errors were encountered: