org.mockito.exceptions
public class Reporter extends Object
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).
public static MockitoException checkedExceptionInvalid(Throwable t)
public static MockitoException cannotStubWithNullThrowable()
public static MockitoException unfinishedStubbing(Location location)
public static MockitoException incorrectUseOfApi()
public static MockitoException missingMethodInvocation()
public static MockitoException unfinishedVerificationException(Location location)
public static MockitoException notAMockPassedToVerify(Class<?> type)
public static MockitoException nullPassedToVerify()
public static MockitoException notAMockPassedToWhenMethod()
public static MockitoException nullPassedToWhenMethod()
public static MockitoException mocksHaveToBePassedToVerifyNoMoreInteractions()
public static MockitoException notAMockPassedToVerifyNoMoreInteractions()
public static MockitoException nullPassedToVerifyNoMoreInteractions()
public static MockitoException notAMockPassedWhenCreatingInOrder()
public static MockitoException nullPassedWhenCreatingInOrder()
public static MockitoException mocksHaveToBePassedWhenCreatingInOrder()
public static MockitoException inOrderRequiresFamiliarMock()
public static MockitoException invalidUseOfMatchers(int expectedMatchersCount, List<LocalizedMatcher> recordedMatchers)
public static MockitoException incorrectUseOfAdditionalMatchers(String additionalMatcherName, int expectedSubMatchersCount, Collection<LocalizedMatcher> matcherStack)
public static MockitoException stubPassedToVerify()
public static MockitoException reportNoSubMatchersFound(String additionalMatcherName)
public static AssertionError argumentsAreDifferent(String wanted, String actual, Location actualLocation)
public static MockitoAssertionError wantedButNotInvoked(DescribedInvocation wanted)
public static MockitoAssertionError wantedButNotInvoked(DescribedInvocation wanted, List<? extends DescribedInvocation> invocations)
public static MockitoAssertionError wantedButNotInvokedInOrder(DescribedInvocation wanted, DescribedInvocation previous)
public static MockitoAssertionError tooManyActualInvocations(int wantedCount, int actualCount, DescribedInvocation wanted, Location firstUndesired)
public static MockitoAssertionError neverWantedButInvoked(DescribedInvocation wanted, Location firstUndesired)
public static MockitoAssertionError tooManyActualInvocationsInOrder(int wantedCount, int actualCount, DescribedInvocation wanted, Location firstUndesired)
public static MockitoAssertionError tooLittleActualInvocations(Discrepancy discrepancy, DescribedInvocation wanted, Location lastActualLocation)
public static MockitoAssertionError tooLittleActualInvocationsInOrder(Discrepancy discrepancy, DescribedInvocation wanted, Location lastActualLocation)
public static MockitoAssertionError noMoreInteractionsWanted(Invocation undesired, List<VerificationAwareInvocation> invocations)
public static MockitoAssertionError noMoreInteractionsWantedInOrder(Invocation undesired)
public static MockitoException cannotMockClass(Class<?> clazz, String reason)
public static MockitoException cannotStubVoidMethodWithAReturnValue(String methodName)
public static MockitoException onlyVoidMethodsCanBeSetToDoNothing()
public static MockitoException wrongTypeOfReturnValue(String expectedType, String actualType, String methodName)
public static MockitoException wrongTypeReturnedByDefaultAnswer(Object mock, String expectedType, String actualType, String methodName)
public static MockitoAssertionError wantedAtMostX(int maxNumberOfInvocations, int foundSize)
public static MockitoException misplacedArgumentMatcher(List<LocalizedMatcher> lastMatchers)
public static MockitoException smartNullPointerException(String invocation, Location location)
public static MockitoException noArgumentValueWasCaptured()
public static MockitoException extraInterfacesDoesNotAcceptNullParameters()
public static MockitoException extraInterfacesAcceptsOnlyInterfaces(Class<?> wrongType)
public static MockitoException extraInterfacesCannotContainMockedType(Class<?> wrongType)
public static MockitoException extraInterfacesRequiresAtLeastOneInterface()
public static MockitoException mockedTypeIsInconsistentWithSpiedInstanceType(Class<?> mockedType, Object spiedInstance)
public static MockitoException cannotCallAbstractRealMethod()
public static MockitoException cannotVerifyToString()
public static MockitoException moreThanOneAnnotationNotAllowed(String fieldName)
public static MockitoException unsupportedCombinationOfAnnotations(String undesiredAnnotationOne, String undesiredAnnotationTwo)
public static MockitoException cannotInitializeForSpyAnnotation(String fieldName, Exception details)
public static MockitoException cannotInitializeForInjectMocksAnnotation(String fieldName, Exception details)
public static MockitoException atMostAndNeverShouldNotBeUsedWithTimeout()
public static MockitoException fieldInitialisationThrewException(Field field, Throwable details)
public static MockitoException invocationListenerDoesNotAcceptNullParameters()
public static MockitoException invocationListenersRequiresAtLeastOneListener()
public static MockitoException invocationListenerThrewException(InvocationListener listener, Throwable listenerThrowable)
public static MockitoException cannotInjectDependency(Field field, Object matchingMock, Exception details)
public static MockitoException mockedTypeIsInconsistentWithDelegatedInstanceType(Class<?> mockedType, Object delegatedInstance)
public static MockitoException spyAndDelegateAreMutuallyExclusive()
public static MockitoException invalidArgumentRangeAtIdentityAnswerCreationTime()
public static MockitoException invalidArgumentPositionRangeAtInvocationTime(InvocationOnMock invocation, boolean willReturnLastParameter, int argumentIndex)
public static MockitoException wrongTypeOfArgumentToReturn(InvocationOnMock invocation, String expectedType, Class<?> actualType, int argumentIndex)
public static MockitoException defaultAnswerDoesNotAcceptNullParameter()
public static MockitoException serializableWontWorkForObjectsThatDontImplementSerializable(Class<?> classToMock)
public static MockitoException delegatedMethodHasWrongReturnType(Method mockMethod, Method delegateMethod, Object mock, Object delegate)
public static MockitoException delegatedMethodDoesNotExistOnDelegate(Method mockMethod, Object mock, Object delegate)
public static MockitoException usingConstructorWithFancySerializable(SerializableMode mode)
public static MockitoException cannotCreateTimerWithNegativeDurationTime(long durationMillis)
public static MockitoException notAnException()