Its good to write unit tests cases, and this part is mostly forgotten by developers. It can ease various issues that can come up while integrations.
I’m listing down various issues or problems that we faced while writing JUnit test cases:
LinkageError: Loader constraint violation
This is the issue you face when somewhere in your dependency you are using a component whose mock is not supported by mock libraries. Or, mock libraries can not mock a class.
In this case, the solution is to tell PowerMock that please ignore particular package to mock. We are asking mock loader not to load particular package/classes.
And, you can do this by putting an annotation on top of class like below:
And, next time you run, the issue is gone. Enjoy