Class DefaultLenientStubber

    • Field Detail

      • MOCKITO_CORE

        private static final MockitoCore MOCKITO_CORE
    • Constructor Detail

      • DefaultLenientStubber

        public DefaultLenientStubber()
    • Method Detail

      • doThrow

        public Stubber doThrow​(java.lang.Throwable... toBeThrown)
        Description copied from interface: BaseStubber
        Use it for stubbing consecutive calls in Mockito.doThrow(Throwable[]) style:
        
           doThrow(new RuntimeException("one")).
           doThrow(new RuntimeException("two"))
               .when(mock).someVoidMethod();
         
        See javadoc for Mockito.doThrow(Throwable[])
        Specified by:
        doThrow in interface BaseStubber
        Parameters:
        toBeThrown - to be thrown when the stubbed method is called
        Returns:
        stubber - to select a method for stubbing
      • doThrow

        public Stubber doThrow​(java.lang.Class<? extends java.lang.Throwable> toBeThrown)
        Description copied from interface: BaseStubber
        Use it for stubbing consecutive calls in Mockito.doThrow(Class) style:
        
           doThrow(RuntimeException.class).
           doThrow(IllegalArgumentException.class)
               .when(mock).someVoidMethod();
         
        See javadoc for Mockito.doThrow(Class)
        Specified by:
        doThrow in interface BaseStubber
        Parameters:
        toBeThrown - exception class to be thrown when the stubbed method is called
        Returns:
        stubber - to select a method for stubbing
      • doThrow

        public Stubber doThrow​(java.lang.Class<? extends java.lang.Throwable> toBeThrown,
                               java.lang.Class<? extends java.lang.Throwable>... nextToBeThrown)
        Description copied from interface: BaseStubber
        Use it for stubbing consecutive calls in Mockito.doThrow(Class) style:
        
           doThrow(RuntimeException.class).
           doThrow(IllegalArgumentException.class)
               .when(mock).someVoidMethod();
         
        See javadoc for Mockito.doThrow(Class)
        Specified by:
        doThrow in interface BaseStubber
        Parameters:
        toBeThrown - exception class to be thrown when the stubbed method is called
        nextToBeThrown - exception class next to be thrown when the stubbed method is called
        Returns:
        stubber - to select a method for stubbing
      • doReturn

        public Stubber doReturn​(java.lang.Object toBeReturned,
                                java.lang.Object... nextToBeReturned)
        Description copied from interface: BaseStubber
        Use it for stubbing consecutive calls in Mockito.doReturn(Object) style.

        See javadoc for Mockito.doReturn(Object, Object...)

        Specified by:
        doReturn in interface BaseStubber
        Parameters:
        toBeReturned - to be returned when the stubbed method is called
        nextToBeReturned - to be returned in consecutive calls when the stubbed method is called
        Returns:
        stubber - to select a method for stubbing
      • stubber

        private static Stubber stubber()