Hi Johan
That works but only until I reset the mock, the following test case
gives this error
"java.lang.IllegalStateException: no last call on a mock available"
on the last line.
Ride
--------------------------------------------------------------------------------------
package staticvoid;
public class StaticVoid
{
public static void doNothing()
{
}
}
--------------------------------------------------------------------------------------
package staticvoid;
import static org.powermock.api.easymock.PowerMock.*;
import org.easymock.classextension.EasyMock;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest(StaticVoid.class)
public class StaticVoidTest
{
@Test
public void testname() throws InterruptedException
{
mockStatic(StaticVoid.class);
StaticVoid.doNothing();
EasyMock.expectLastCall().once();
replay(StaticVoid.class);
StaticVoid.doNothing();
verify(StaticVoid.class);
reset(StaticVoid.class);
StaticVoid.doNothing();
EasyMock.expectLastCall().once();
}
}
On Jan 9, 2:36 pm, "Johan Haleby" <
johan.hal...@gmail.com> wrote:
> You just invoke the method then do expectLastCall().once() for example, e.g.
>
> MyClass.myVoidMethod();
> EasyMock.expectLastCall().once();
>
> /Johan
>