I am trying to verify the static methods present in a class InOrder. Below is the sample class that is having a few static methods
public class SampleClass {
public static void staticMethod1(Param1 param)
{
//doSomething
}
public static void staticMethod2(Param2 param)
{
//doSomething
}
public static void staticMethod2(Param3 param)
{
//doSomething
}
}
public class parent{
public void method() {
SampleClass.staticMethod1(...);
SampleClass.staticMethod2(...);
SampleClass.staticMethod3(...);
}
}
And my test looks like this
@Test
public void test(){
try (MockedStatic<SamplClass > mockSamplClass = mockStatic(SamplClass .class, Answers.CALLS_REAL_METHODS))
{
//doStuff
mockSampleClass.verify(()->SampleClass.staticMethod1(...));
mockSampleClass.verify(()->SampleClass.staticMethod2(...));
mockSampleClass.verify(()->SampleClass.staticMethod3(...));
}
}
Is there any way to perform InOrder verification for the three static methods? As Mockito.inOrder takes in only mock types and not MockedStatic types.
Right now I am kind of looking for answers in Mockito not involving PowerMockito.