Class PanacheStubber

java.lang.Object
io.quarkus.panache.mock.PanacheStubber

public class PanacheStubber extends Object
  • Constructor Details

    • PanacheStubber

      public PanacheStubber(org.mockito.stubbing.Stubber stubber)
  • Method Details

    • when

      public <T> T when(Class<T> mock)
      Allows to choose a method when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style

      Example:

       
         doThrow(new RuntimeException())
         .when(mockedList).clear();
      
         //following throws RuntimeException:
         mockedList.clear();
       
       
      Read more about those methods:

      Mockito.doThrow(Throwable[])

      Mockito.doAnswer(Answer)

      Mockito.doNothing()

      Mockito.doReturn(Object)

      See examples in javadoc for Mockito

      Parameters:
      mock - The mock
      Returns:
      select method for stubbing