Class PanacheStubber


  • public class PanacheStubber
    extends Object
    • Constructor Detail

      • PanacheStubber

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

      • 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