jeudi 24 décembre 2015

Is it possible to mock a static void method in powermock

A class has a method inside which there are several calls of other class's static void methods.

i.e.

public class Foo()
{
 public void Bar()
{
  //some code
  OtherClass.callVoidMethod1();
 // some code
OtherClass.callVoidMethod2();
}
}

In my unit tests I need OtherClass.callVoidMethod2(); not to be called and was suggested to mock it. But so far I can't find how to mock static void method call. Is it even possible? Available in the project: mockito, powermock, testng.

Aucun commentaire:

Enregistrer un commentaire