use of org.mockito.stubbing.ValidableAnswer in project mockito by mockito.
the class InvocationContainerImpl method addAnswer.
/**
* Adds new stubbed answer and returns the invocation matcher the answer was added to.
*/
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();
}
}
use of org.mockito.stubbing.ValidableAnswer in project mockito by mockito.
the class InvocationContainerImpl method addAnswer.
/**
* Adds new stubbed answer and returns the invocation matcher the answer was added to.
*/
public StubbedInvocationMatcher addAnswer(Answer answer, boolean isConsecutive) {
Invocation invocation = invocationForStubbing.getInvocation();
mockingProgress().stubbingCompleted();
if (answer instanceof ValidableAnswer) {
((ValidableAnswer) answer).validateFor(invocation);
}
synchronized (stubbed) {
if (isConsecutive) {
stubbed.getFirst().addAnswer(answer);
} else {
stubbed.addFirst(new StubbedInvocationMatcher(invocationForStubbing, answer));
}
return stubbed.getFirst();
}
}
Aggregations