Class StubberImpl

    • Field Detail

      • answers

        private final java.util.List<Answer<?>> answers
    • Constructor Detail

      • StubberImpl

        public StubberImpl​(Strictness strictness)
    • Method Detail

      • 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
      • doReturnValues

        private StubberImpl doReturnValues​(java.lang.Object... toBeReturned)
      • 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