Issue
How do I verify a call to a static method in a final class using jMockit?
In PowerMockito, this isn't possible because the class is final. If this can't be done using jMockit, what are the alternatives?
Solution
You should be able to do it in PowerMockito, yes.
Anyway, in JMockit, you usually would write a verification block like the following:
@Test
public void exampleTest(@Mocked AFinalClass mock)
{
// Call the code under test which uses AFinalClass.
new Verifications() {{ AFinalClass.someStaticMethod(); }};
}
Answered By - Rogério
Answer Checked By - David Goodson (JavaFixing Volunteer)