Open GoogleCodeExporter opened 8 years ago
From the first glance it does look "interesting". Can you tell us the stack
trace (ie where is it failing), also what kind/version of java do you use?
I dont think its related but you can try: make mocked methods public, avoid
static state.
We'll look at this problem.
Cheers!
Original comment by szcze...@gmail.com
on 11 Apr 2012 at 5:34
Run the code
I cant say more
Original comment by liamjk...@gmail.com
on 13 Apr 2012 at 11:56
>Run the code
can't do it on my phone :) We'll try your sample soon. More details usually
help because some of us might have an answer straight away.
Original comment by szcze...@gmail.com
on 13 Apr 2012 at 6:18
I think its to do with how your spy() first evaluates the Mock to determine
what to do when its really invoked.
But I didn't trace it very far.
The code example is about as simple as it can be an will run with
JUnit/Mockito required
Original comment by liamjk...@gmail.com
on 13 Apr 2012 at 11:24
Hi,
I traced a little bit this test, and in case of "other" is a mock, I noticed
that
Mockito.when(realObject.getPackage("a")).thenReturn("1");
actually mocks other.doSomething() and not realObject.getPackage("a")
So at the 2nd method mocking
Mockito.when(realObject.getPackage("b")).thenReturn(null);
other.doSomething() will return null, which explains the assert failure.
I will try to investigate further.
Original comment by ludoch...@gmail.com
on 20 Jul 2012 at 9:24
Thanks Ludovic :)
Original comment by brice.du...@gmail.com
on 20 Jul 2012 at 10:34
Original issue reported on code.google.com by
liamjk...@gmail.com
on 11 Apr 2012 at 5:06