Mockito 3.6 supports mocking static methods under a try-with-resources
block as explained here.
Can someone let me know if static methods are mocked using Powermock in @Before
or @BeforeClass
can Mockito.mockStatic
be used to replace them without an entire rewrite of the test class?
I think you might need to do a little bit of refactoring. You can create mocks of static methods by creating a MockedStatic variable at class level and use that in your tests and also sometimes it needs to be closed in the @After block, something like