What steps will reproduce the problem?
The following test case can reproduce the issue:
package au.com.sensis.sitesmart;
import com.day.cq.search.Query;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.jcr.Node;
import java.util.Iterator;
@RunWith(PowerMockRunner.class)
@PrepareForTest({Query.class})
public class SampleTest extends AbstractServiceTest {
@Mock(name = "Mock Query", answer = Answers.RETURNS_DEEP_STUBS)
private Query query;
@Mock(name = "Mock Nodes")
private Iterator<Node> queryResult;
@Test
public void deepStubsTest() {
Mockito.when(query.getResult().getNodes()).thenReturn(queryResult);
System.out.println(query.getResult().getNodes());
}
}
What is the expected output? What do you see instead?
Test should pass.
What version of the product are you using? On what operating system?
PowerMock 1.5.5 with Mockito 1.9.5.
Original issue reported on code.google.com by behran...@gmail.com on 4 Aug 2014 at 4:55
Original issue reported on code.google.com by
behran...@gmail.com
on 4 Aug 2014 at 4:55