MCPcopy
hub / github.com/mockito/mockito / Answer

Interface Answer

mockito-core/src/main/java/org/mockito/stubbing/Answer.java:31–40  ·  view source on GitHub ↗

Generic interface to be used for configuring mock's answer. Answer specifies an action that is executed and a return value that is returned when you interact with the mock. Example of stubbing a mock with custom answer: when(mock.someMethod(anyString())).th

Source from the content-addressed store, hash-verified

29 * @param <T> the type to return.
30 */
31public interface Answer<T> {
32 /**
33 * @param invocation the invocation on the mock.
34 *
35 * @return the value to be returned
36 *
37 * @throws Throwable the throwable to be thrown
38 */
39 T answer(InvocationOnMock invocation) throws Throwable;
40}

Implementers 15

ThrowsSmartNullPointermockito-core/src/main/java/org/mockito
CompilationWarningsTestmockito-core/src/test/java/org/mockito
PlaygroundWithDemoOfUnclonedParametersProblemTestmockito-core/src/test/java/org/mockito
StubbingWithCustomAnswerTestmockito-core/src/test/java/org/mockito
RecordCallmockito-core/src/test/java/org/mockito
StubbingWithAdditionalAnswersTestmockito-core/src/test/java/org/mockito
MockitoStubbedCallInAnswerTestmockito-core/src/test/java/org/mockito
LockingAnswermockito-core/src/test/java/org/mockito
SpyingOnInterfacesTestmockito-core/src/test/java/org/mockito
ClassPathLoaderTestmockito-core/src/test/java/org/mockito
AdditionalAnswersmockito-core/src/main/java/org/mockito

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…