Class RunRunnableAnswer

  • All Implemented Interfaces:
    org.mockito.stubbing.Answer<Object>

    public class RunRunnableAnswer
    extends Object
    implements org.mockito.stubbing.Answer<Object>
    Answer for simplified mocking of methods accepting Runnable. It will execute the given closure. Example: doAnswer(runRunnable()).when(permissionManager).withExemption(any(Runnable.class));
    Since:
    5.7
    • Constructor Detail

      • RunRunnableAnswer

        public RunRunnableAnswer()
    • Method Detail

      • answer

        public Object answer​(org.mockito.invocation.InvocationOnMock invocation)
                      throws Throwable
        Specified by:
        answer in interface org.mockito.stubbing.Answer<Object>
        Throws:
        Throwable