public StubbedInvocationMatcher addAnswer ( Answer answer , boolean isConsecutive , Strictness stubbingStrictness ) { Invocation invocation = invocationForStubbing . getInvocation ( ) ; mockingProgress ( ) . stubbingCompleted ( ) ; if ( answer instanceof ValidableAnswer ) { ( ( ValidableAnswer ) answer ) . validateFor ( invocation ) ; } synchronized ( stubbed ) { if ( isConsecutive ) { stubbed . getFirst ( ) . addAnswer ( answer ) ; } else { Strictness effectiveStrictness = stubbingStrictness != null ? stubbingStrictness : this . mockStrictness ; stubbed . addFirst ( new StubbedInvocationMatcher ( answer , invocationForStubbing , effectiveStrictness ) ) ; } return stubbed . getFirst ( ) ; } }
Adds new stubbed answer and returns the invocation matcher the answer was added to .