blob: a5cdc048292db02b5a813894872a2a596a309d12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.stubbing;
import org.mockito.stubbing.Answer;
import org.mockito.stubbing.OngoingStubbing;
public class ConsecutiveStubbing<T> extends BaseStubbing<T> {
private final InvocationContainerImpl invocationContainerImpl;
public ConsecutiveStubbing(InvocationContainerImpl invocationContainerImpl) {
this.invocationContainerImpl = invocationContainerImpl;
}
public OngoingStubbing<T> thenAnswer(Answer<?> answer) {
invocationContainerImpl.addConsecutiveAnswer(answer);
return this;
}
public OngoingStubbing<T> then(Answer<?> answer) {
return thenAnswer(answer);
}
@SuppressWarnings("unchecked")
public <M> M getMock() {
return (M) invocationContainerImpl.invokedMock();
}
}
|