Class ConsecutiveStubbing<T>

    • Method Detail

      • thenAnswer

        public OngoingStubbing<T> thenAnswer​(Answer<?> answer)
        Description copied from interface: OngoingStubbing
        Sets a generic Answer for the method. E.g:
        
         when(mock.someMethod(10)).thenAnswer(new Answer<Integer>() {
             public Integer answer(InvocationOnMock invocation) throws Throwable {
                 return (Integer) invocation.getArguments()[0];
             }
         }
         
        Parameters:
        answer - the custom answer to execute.
        Returns:
        object that allows stubbing consecutive calls