public void addConsecutiveAnswer(Answer answer) { addAnswer(answer, true, null); }
public void addConsecutiveAnswer(Answer answer) { addAnswer(answer, true); }
public void addAnswer(Answer answer, Strictness stubbingStrictness) { registeredInvocations.removeLast(); addAnswer(answer, false, stubbingStrictness); }
private StubbedInvocationMatcher recordDeepStubAnswer(final Object mock, InvocationContainerImpl container) { DeeplyStubbedAnswer answer = new DeeplyStubbedAnswer(mock); return container.addAnswer(answer, false, null); }
private Object recordDeepStubMock(InvocationOnMock invocation, InvocationContainerImpl container) { Class<?> clz = invocation.getMethod().getReturnType(); final Object mock = Mockito.mock(clz, this); container.addAnswer(new Answer<Object>() { public Object answer(InvocationOnMock invocation) throws Throwable { return mock; } }, false); return mock; } }
public void addAnswer(Answer answer) { registeredInvocations.removeLast(); addAnswer(answer, false); }
public void setMethodForStubbing(InvocationMatcher invocation) { invocationForStubbing = invocation; assert hasAnswersForStubbing(); for (int i = 0; i < answersForStubbing.size(); i++) { addAnswer(answersForStubbing.get(i), i != 0); } answersForStubbing.clear(); }
public DeprecatedOngoingStubbing<T> toAnswer(Answer<?> answer) { invocationContainerImpl.addAnswer(answer); return new ConsecutiveStubbing<T>(invocationContainerImpl); }
@Override public OngoingStubbing<T> thenAnswer(Answer<?> answer) { if(!invocationContainer.hasInvocationForPotentialStubbing()) { throw incorrectUseOfApi(); } invocationContainer.addAnswer(answer, strictness); return new ConsecutiveStubbing<T>(invocationContainer); }
public void setMethodForStubbing(MatchableInvocation invocation) { invocationForStubbing = invocation; assert hasAnswersForStubbing(); for (int i = 0; i < doAnswerStyleStubbing.getAnswers().size(); i++) { addAnswer(doAnswerStyleStubbing.getAnswers().get(i), i != 0, doAnswerStyleStubbing.getStubbingStrictness()); } doAnswerStyleStubbing.clear(); }
public OngoingStubbing<T> thenAnswer(Answer<?> answer) { if(!invocationContainerImpl.hasInvocationForPotentialStubbing()) { new Reporter().incorrectUseOfApi(); } invocationContainerImpl.addAnswer(answer); return new ConsecutiveStubbing<T>(invocationContainerImpl); }
public void addConsecutiveAnswer(Answer answer) { addAnswer(answer, true); }
public void setMethodForStubbing(InvocationMatcher invocation) { invocationForStubbing = invocation; assert hasAnswersForStubbing(); for (int i = 0; i < answersForStubbing.size(); i++) { addAnswer(answersForStubbing.get(i), i != 0); } answersForStubbing.clear(); }
public void addAnswer(Answer answer) { registeredInvocations.removeLast(); addAnswer(answer, false); }
public DeprecatedOngoingStubbing<T> toAnswer(Answer<?> answer) { invocationContainerImpl.addAnswer(answer); return new ConsecutiveStubbing<T>(invocationContainerImpl); }
private Object getMock(InvocationOnMock invocation) { Class<?> clz = invocation.getMethod().getReturnType(); final Object mock = Mockito.mock(clz, this); MockHandlerInterface<Object> handler = new MockUtil().getMockHandler(invocation.getMock()); InvocationContainerImpl container = (InvocationContainerImpl)handler.getInvocationContainer(); container.addAnswer(new Answer<Object>() { public Object answer(InvocationOnMock invocation) throws Throwable { return mock; } }, false); return mock; } }
public OngoingStubbing<T> thenAnswer(Answer<?> answer) { if(!invocationContainerImpl.hasInvocationForPotentialStubbing()) { new Reporter().incorrectUseOfApi(); } invocationContainerImpl.addAnswer(answer); return new ConsecutiveStubbing<T>(invocationContainerImpl); }