Class RunRunnableAnswer

java.lang.Object
com.atlassian.confluence.util.test.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 Details

    • RunRunnableAnswer

      public RunRunnableAnswer()
  • Method Details

    • runRunnable

      public static RunRunnableAnswer runRunnable()
    • answer

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