I am using ConfigProvider.getConfig().getValue("myproject.some.remote.service.url", String.class); from org.eclipse.microprofile.config . when iam trying to mock the ConfigProvider class getting org.mockito.exceptions.base.MockitoException cannot mock/spy org.eclipse.microprofile.config.ConfigProvider. Need help in resolving the issue.
Asked
Active
Viewed 139 times
0
-
You are trying to mock a final class. You need to use the inline mock maker. Check the docs: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#39 – Lesiak Dec 07 '21 at 17:52
-
Does this answer your question? [How to mock a final class with mockito](https://stackoverflow.com/questions/14292863/how-to-mock-a-final-class-with-mockito) – Lesiak Dec 07 '21 at 18:05