Examples of InvalidUseOfMatchersException


Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

                ""
        ));
    }

    public void reportNoSubMatchersFound(String additionalMatcherName) {
        throw new InvalidUseOfMatchersException(join(
                "No matchers found for additional matcher " + additionalMatcherName,
                new LocationImpl(),
                ""
        ));
    }
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    public void wantedAtMostX(int maxNumberOfInvocations, int foundSize) {
        throw new MockitoAssertionError(join("Wanted at most " + pluralize(maxNumberOfInvocations) + " but was " + foundSize));
    }

    public void misplacedArgumentMatcher(List<LocalizedMatcher> lastMatchers) {
        throw new InvalidUseOfMatchersException(join(
                "Misplaced argument matcher detected here:",
                locationsOf(lastMatchers),
                "",
                "You cannot use argument matchers outside of verification or stubbing.",
                "Examples of correct usage of argument matchers:",
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    @SuppressWarnings("rawtypes")
        MockHandlerImpl<?> handler = new MockHandlerImpl(new MockSettingsImpl());
    handler.mockingProgress.verificationStarted(VerificationModeFactory.atLeastOnce());
    handler.matchersBinder = new MatchersBinder() {
      public InvocationMatcher bindMatchers(ArgumentMatcherStorage argumentMatcherStorage, Invocation invocation) {
        throw new InvalidUseOfMatchersException();
      }
    };

    try {
      // when
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    }

    private void assertState(boolean toAssert, String message) {
        if (!toAssert) {
            matcherStack.clear();
            throw new InvalidUseOfMatchersException(message);
        }
    }
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

                "    inOrder.verify(mockOne).doStuff();"
                ));
    }
   
    public void invalidUseOfMatchers(int expectedMatchersCount, int recordedMatchersCount) {
        throw new InvalidUseOfMatchersException(join(
                "Invalid use of argument matchers!",
                expectedMatchersCount + " matchers expected, " + recordedMatchersCount + " recorded.",
                "This exception may occur if matchers are combined with raw values:",       
                "    //incorrect:",
                "    someMethod(anyObject(), \"raw String\");",
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    public void wantedAtMostX(int maxNumberOfInvocations, int foundSize) {
        throw new MockitoAssertionError(join("Wanted at most " + pluralize(maxNumberOfInvocations) + " but was " + foundSize));
    }

    public void misplacedArgumentMatcher() {
        throw new InvalidUseOfMatchersException(join(
                "Misplaced argument matcher detected!",
                "Somewhere before this line you probably misused Mockito argument matchers.",
                "For example you might have used anyObject() argument matcher outside of verification or stubbing.",
                "Here are examples of correct usage of argument matchers:",
                "    when(mock.get(anyInt())).thenReturn(null);",
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    }

    private void assertState(boolean toAssert, String message) {
        if (!toAssert) {
            matcherStack.clear();
            throw new InvalidUseOfMatchersException(message);
        }
    }
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

                "    inOrder.verify(mockOne).doStuff();"
                ));
    }
   
    public void invalidUseOfMatchers(int expectedMatchersCount, int recordedMatchersCount) {
        throw new InvalidUseOfMatchersException(join(
                "Invalid use of argument matchers!",
                expectedMatchersCount + " matchers expected, " + recordedMatchersCount + " recorded.",
                "This exception may occur if matchers are combined with raw values:",       
                "    //incorrect:",
                "    someMethod(anyObject(), \"raw String\");",
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    public void wantedAtMostX(int maxNumberOfInvocations, int foundSize) {
        throw new MockitoAssertionError(join("Wanted at most " + pluralize(maxNumberOfInvocations) + " but was " + foundSize));
    }

    public void misplacedArgumentMatcher(Location location) {
        throw new InvalidUseOfMatchersException(join(
                "Misplaced argument matcher detected here:",
                location,
                "",
                "You cannot use argument matchers outside of verification or stubbing.",
                "Examples of correct usage of argument matchers:",
View Full Code Here

Examples of org.mockito.exceptions.misusing.InvalidUseOfMatchersException

    }

    private void assertState(boolean toAssert, String message) {
        if (!toAssert) {
            matcherStack.clear();
            throw new InvalidUseOfMatchersException(message);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.