org.mockito.exceptions
Class Reporter

java.lang.Object
  extended by org.mockito.exceptions.Reporter

public class Reporter
extends java.lang.Object

Reports verification and misusing errors.

One of the key points of mocking library is proper verification/exception messages. All messages in one place makes it easier to tune and amend them.

Reporter can be injected and therefore is easily testable.

Generally, exception messages are full of line breaks to make them easy to read (xunit plugins take only fraction of screen on modern IDEs).


Constructor Summary
Reporter()
           
 
Method Summary
 void argumentsAreDifferent(PrintableInvocation wanted, PrintableInvocation actual, HasStackTrace actualStackTrace)
           
 void cannotMockFinalClass(java.lang.Class<?> clazz)
           
 void cannotStubVoidMethodWithAReturnValue()
           
 void cannotStubWithNullThrowable()
           
 void checkedExceptionInvalid(java.lang.Throwable t)
           
 void inOrderRequiresFamiliarMock()
           
 void invalidUseOfMatchers(int expectedMatchersCount, int recordedMatchersCount)
           
 void missingMethodInvocation()
           
 void mocksHaveToBePassedToVerifyNoMoreInteractions()
           
 void mocksHaveToBePassedWhenCreatingInOrder()
           
 void neverWantedButInvoked(PrintableInvocation wanted, HasStackTrace firstUndesired)
           
 void noMoreInteractionsWanted(PrintableInvocation undesired, HasStackTrace actualInvocationStackTrace)
           
 void notAMockPassedToVerify()
           
 void notAMockPassedToVerifyNoMoreInteractions()
           
 void notAMockPassedToWhenMethod()
           
 void notAMockPassedWhenCreatingInOrder()
           
 void nullPassedToVerify()
           
 void nullPassedToVerifyNoMoreInteractions()
           
 void nullPassedToWhenMethod()
           
 void nullPassedWhenCreatingInOrder()
           
 void onlyVoidMethodsCanBeSetToDoNothing()
           
 void tooLittleActualInvocations(int wantedCount, int actualCount, PrintableInvocation wanted, HasStackTrace lastActualInvocationStackTrace)
           
 void tooLittleActualInvocationsInOrder(int wantedCount, int actualCount, PrintableInvocation wanted, HasStackTrace lastActualStackTrace)
           
 void tooManyActualInvocations(int wantedCount, int actualCount, PrintableInvocation wanted, HasStackTrace firstUndesired)
           
 void tooManyActualInvocationsInOrder(int wantedCount, int actualCount, PrintableInvocation wanted, HasStackTrace firstUndesired)
           
 void unfinishedStubbing()
           
 void unfinishedVerificationException()
           
 void wantedButNotInvoked(PrintableInvocation wanted)
           
 void wantedButNotInvokedInOrder(PrintableInvocation wanted, PrintableInvocation previous, HasStackTrace previousStackTrace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reporter

public Reporter()
Method Detail

checkedExceptionInvalid

public void checkedExceptionInvalid(java.lang.Throwable t)

cannotStubWithNullThrowable

public void cannotStubWithNullThrowable()

unfinishedStubbing

public void unfinishedStubbing()

missingMethodInvocation

public void missingMethodInvocation()

unfinishedVerificationException

public void unfinishedVerificationException()

notAMockPassedToVerify

public void notAMockPassedToVerify()

nullPassedToVerify

public void nullPassedToVerify()

notAMockPassedToWhenMethod

public void notAMockPassedToWhenMethod()

nullPassedToWhenMethod

public void nullPassedToWhenMethod()

mocksHaveToBePassedToVerifyNoMoreInteractions

public void mocksHaveToBePassedToVerifyNoMoreInteractions()

notAMockPassedToVerifyNoMoreInteractions

public void notAMockPassedToVerifyNoMoreInteractions()

nullPassedToVerifyNoMoreInteractions

public void nullPassedToVerifyNoMoreInteractions()

notAMockPassedWhenCreatingInOrder

public void notAMockPassedWhenCreatingInOrder()

nullPassedWhenCreatingInOrder

public void nullPassedWhenCreatingInOrder()

mocksHaveToBePassedWhenCreatingInOrder

public void mocksHaveToBePassedWhenCreatingInOrder()

inOrderRequiresFamiliarMock

public void inOrderRequiresFamiliarMock()

invalidUseOfMatchers

public void invalidUseOfMatchers(int expectedMatchersCount,
                                 int recordedMatchersCount)

argumentsAreDifferent

public void argumentsAreDifferent(PrintableInvocation wanted,
                                  PrintableInvocation actual,
                                  HasStackTrace actualStackTrace)

wantedButNotInvoked

public void wantedButNotInvoked(PrintableInvocation wanted)

wantedButNotInvokedInOrder

public void wantedButNotInvokedInOrder(PrintableInvocation wanted,
                                       PrintableInvocation previous,
                                       HasStackTrace previousStackTrace)

tooManyActualInvocations

public void tooManyActualInvocations(int wantedCount,
                                     int actualCount,
                                     PrintableInvocation wanted,
                                     HasStackTrace firstUndesired)

neverWantedButInvoked

public void neverWantedButInvoked(PrintableInvocation wanted,
                                  HasStackTrace firstUndesired)

tooManyActualInvocationsInOrder

public void tooManyActualInvocationsInOrder(int wantedCount,
                                            int actualCount,
                                            PrintableInvocation wanted,
                                            HasStackTrace firstUndesired)

tooLittleActualInvocations

public void tooLittleActualInvocations(int wantedCount,
                                       int actualCount,
                                       PrintableInvocation wanted,
                                       HasStackTrace lastActualInvocationStackTrace)

tooLittleActualInvocationsInOrder

public void tooLittleActualInvocationsInOrder(int wantedCount,
                                              int actualCount,
                                              PrintableInvocation wanted,
                                              HasStackTrace lastActualStackTrace)

noMoreInteractionsWanted

public void noMoreInteractionsWanted(PrintableInvocation undesired,
                                     HasStackTrace actualInvocationStackTrace)

cannotMockFinalClass

public void cannotMockFinalClass(java.lang.Class<?> clazz)

cannotStubVoidMethodWithAReturnValue

public void cannotStubVoidMethodWithAReturnValue()

onlyVoidMethodsCanBeSetToDoNothing

public void onlyVoidMethodsCanBeSetToDoNothing()