Closed GoogleCodeExporter closed 9 years ago
Thx Eric for your patch. I'll look into it.
Original comment by brice.du...@gmail.com
on 7 Oct 2011 at 1:25
Sorry for late feedback - I think I don't understand the use case fully. @Eric,
can you elaborate a bit why you need to do the nested call? BTW. We'are
planning the next release and we're thinking on including the issue.
Cheers!
Original comment by szcze...@gmail.com
on 23 Oct 2011 at 8:00
You mean the container.getInvocationForStubbing().matches()? I submitted a
change that moves that whole for loop logic into
InvocationContainerImpl.answerToCurrentInvocationMatcher() and changed it to
closely match answerTo(Invocation).
Also, just to clarify the surrounding issue. When the code under test executes
a nested mock call, the ReturnsDeepStubs creates an Answer to return the mock.
Later, when the verify is called the code looks like this:
verify(aMock.someCall(anyString())).nestedCall();
When aMock.someCall(anyString()) is called, the MockHandler calls
invocationContainerImpl.findAnswerFor because it doesn't know it's in verify
mode yet so it behaves like this is testable code executing. The findAnswerFor
will only match the answer created by ReturnsDeepStubs during testable code
execution if the arguments to the call wrapped in the verify match exactly,
since the testable code won't pass in argument matchers like we would if were
doing a when statement. So the solution was to reverse the process and instead
of comparing the current invocation to a list of previous stubbed invocation
matchers we instead take the current invocation matcher and compare it to
previous invocations. This way the original Answer that created the mock used
in the testable code is returned by aMock.someCall(anyString()) and
expectations can be checked against it.
Original comment by EricKu...@gmail.com
on 26 Oct 2011 at 4:28
I actually tried it at home, it seems to be working and don't seem to break
other tests, assuming we got it completely covered of course. Aside from that I
suppose this way of remembering which mocks were issued regardless of
verification, seems ok to me for deep stubs.
However this patch could wait the 1.9.1.
Original comment by brice.du...@gmail.com
on 26 Oct 2011 at 4:39
Ok, makes sense.
Original comment by szcze...@gmail.com
on 27 Oct 2011 at 6:13
Ok, i'll commit something this afternon
Original comment by brice.du...@gmail.com
on 27 Oct 2011 at 11:05
Original comment by brice.du...@gmail.com
on 28 Oct 2011 at 5:20
Original comment by szcze...@gmail.com
on 13 May 2012 at 3:37
Original comment by szcze...@gmail.com
on 3 Jun 2012 at 2:06
Original comment by brice.du...@gmail.com
on 2 Dec 2012 at 10:21
Original issue reported on code.google.com by
EricKu...@gmail.com
on 3 Aug 2011 at 6:40