What steps will reproduce the problem?
1. Create a real instance of an of an object with collaborators
2. Create a spied-version using PowerMockito.spy()
3. Dereferencing the collaborator results in a NullPointerException
What is the expected output? What do you see instead?
Normal behavior interrupted by NullPointerException
What version of the product are you using? On what operating system?
1.3.8
Please provide any additional information below.
This issue was discussed in the user group. Please see http://is.gd/cVZ37.
Here is short experiment that details the problem:
@Test public void experiment() {
MyService service = new MyService();
MyService mockitoSpy = Mockito.spy(service);
MyService powermockSpy = PowerMockito.spy(service);
System.out.println("Mockito:" + ((mockitoSpy .getMyDao() != null) ?
"non null" : "null"));
System.out.println("Powermock:" + ((powermockSpy .getMyDao() !=
null) ? "non null" : "null"));
}
Original issue reported on code.google.com by srivaths.sankaran on 20 Jun 2010 at 3:20
Original issue reported on code.google.com by
srivaths.sankaran
on 20 Jun 2010 at 3:20