org.mockito.stubbing
T
- return typeA0
- type of the single argument@Incubating public interface Answer1<T,A0>
Example of stubbing a mock with this custom answer:
when(mock.someMethod(anyString())).thenAnswer(new Answer<Integer, String>() {
Integer answer(String arg) {
return arg.length();
}
});
//Following will print "3"
System.out.println(mock.someMethod("foo"));
Answer