Hi Brice,see below:
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
import java.util.Date;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.powermock.api.mockito.PowerMockito.mock;
import org.powermock.modules.junit4.rule.*;
import static org.powermock.api.mockito.PowerMockito.when;
import static org.powermock.api.mockito.PowerMockito.doReturn;
import static org.powermock.api.mockito.PowerMockito.spy;
import static org.powermock.api.mockito.PowerMockito.verifyPrivate;
@RunWith(PowerMockRunner.class)
@PrepareForTest(StatProduct.class)
public class TestStatProduct {
@Test
public void goOnThen() throws Exception{
StatProduct underTest = spy(new StatProduct());
PowerMockito.when(underTest,
"getNewStr").withNoArguments().thenReturn("hi");
assertEquals("hi",underTest.methodToTest());
verifyPrivate(underTest).invoke("getNewStr");
}
}
[javac] c:\Project\...\TestStatProduct.java:82: cannot find symbol
[javac] symbol : method withNoArguments()
[javac] location: interface
org.mockito.stubbing.OngoingStubbing<java.lang.Object>
[javac] PowerMockito.when(underTest,
"getNewStr").withNoArguments().thenReturn("hi");
[javac] ^
[javac] 1 error
I also tried importing:
org.powermock.api.mockito.expectation.WithoutExpectedArguments.*;
same error.
am using: powermock 1.4.10
Kind regards,
Simon