org.mockito.internal.invocation.InvocationsFinder Java Examples

The following examples show how to use org.mockito.internal.invocation.InvocationsFinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NoMoreInteractions.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void verify(VerificationData data) {
    Invocation unverified = new InvocationsFinder().findFirstUnverified(data.getAllInvocations());
    if (unverified != null) {
        new Reporter().noMoreInteractionsWanted(unverified, (List) data.getAllInvocations());
    }
}
 
Example #2
Source File: ArgumentsExtractorVerifier.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void verify(final VerificationData data) {
    List<Invocation> actualInvocations =
        InvocationsFinder.findInvocations(data.getAllInvocations(), data.getTarget());
    if (actualInvocations.size() != 1) {
        throw new MockitoException("This verifier can only be used with 1 invocation, got "
                + actualInvocations.size());
    }
    Invocation invocation = actualInvocations.get(0);
    arguments = invocation.getArguments();
    invocation.markVerified();
}
 
Example #3
Source File: NoMoreInteractions.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void verifyInOrder(VerificationDataInOrder data) {
    List<Invocation> invocations = data.getAllInvocations();
    Invocation unverified = new InvocationsFinder().findFirstUnverifiedInOrder(data.getOrderingContext(), invocations);
    
    if (unverified != null) {
        new Reporter().noMoreInteractionsWantedInOrder(unverified);
    }
}
 
Example #4
Source File: AtMost.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void verify(VerificationData data) {
    List<Invocation> invocations = data.getAllInvocations();
    InvocationMatcher wanted = data.getWanted();
    
    InvocationsFinder finder = new InvocationsFinder();
    List<Invocation> found = finder.findInvocations(invocations, wanted);
    int foundSize = found.size();
    if (foundSize > maxNumberOfInvocations) {
        new Reporter().wantedAtMostX(maxNumberOfInvocations, foundSize);
    }
    
    invocationMarker.markVerified(found, wanted);
}
 
Example #5
Source File: AtMost.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void verify(VerificationData data) {
    List<Invocation> invocations = data.getAllInvocations();
    InvocationMatcher wanted = data.getWanted();
    
    InvocationsFinder finder = new InvocationsFinder();
    List<Invocation> found = finder.findInvocations(invocations, wanted);
    int foundSize = found.size();
    if (foundSize > maxNumberOfInvocations) {
        new Reporter().wantedAtMostX(maxNumberOfInvocations, foundSize);
    }
    
    invocationMarker.markVerified(found, wanted);
}
 
Example #6
Source File: NoMoreInteractions.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void verify(VerificationData data) {
    Invocation unverified = new InvocationsFinder().findFirstUnverified(data.getAllInvocations());                       
    if (unverified != null) {
        new Reporter().noMoreInteractionsWanted(unverified, (List) data.getAllInvocations());
    }
}
 
Example #7
Source File: NoMoreInteractions.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void verifyInOrder(VerificationDataInOrder data) {
    List<Invocation> invocations = data.getAllInvocations();
    Invocation unverified = new InvocationsFinder().findFirstUnverifiedInOrder(data.getOrderingContext(), invocations);
    
    if (unverified != null) {
        new Reporter().noMoreInteractionsWantedInOrder(unverified);
    }
}
 
Example #8
Source File: MissingInvocationChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
MissingInvocationChecker(InvocationsFinder finder, Reporter reporter) {
    this.finder = finder;
    this.reporter = reporter;
}
 
Example #9
Source File: MissingInvocationInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
MissingInvocationInOrderChecker(InvocationsFinder finder, Reporter reporter) {
    this.finder = finder;
    this.reporter = reporter;
}
 
Example #10
Source File: MissingInvocationInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public MissingInvocationInOrderChecker() {
    this(new InvocationsFinder(), new Reporter());
}
 
Example #11
Source File: NonGreedyNumberOfInvocationsInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
NonGreedyNumberOfInvocationsInOrderChecker(InvocationsFinder finder, Reporter reporter, InvocationMarker marker ) {
    this.finder = finder;
    this.reporter = reporter;
    this.marker = marker;
}
 
Example #12
Source File: NonGreedyNumberOfInvocationsInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public NonGreedyNumberOfInvocationsInOrderChecker() {
    this(new InvocationsFinder(), new Reporter(), new InvocationMarker());
}
 
Example #13
Source File: NumberOfInvocationsChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
NumberOfInvocationsChecker(Reporter reporter, InvocationsFinder finder) {
    this.reporter = reporter;
    this.finder = finder;
}
 
Example #14
Source File: NumberOfInvocationsChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public NumberOfInvocationsChecker() {
    this(new Reporter(), new InvocationsFinder());
}
 
Example #15
Source File: NumberOfInvocationsInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
NumberOfInvocationsInOrderChecker(InvocationsFinder finder, Reporter reporter) {
    this.finder = finder;
    this.reporter = reporter;
}
 
Example #16
Source File: NumberOfInvocationsInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public NumberOfInvocationsInOrderChecker() {
    this(new InvocationsFinder(), new Reporter());
}
 
Example #17
Source File: NumberOfInvocationsInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public NumberOfInvocationsInOrderChecker() {
    this(new InvocationsFinder(), new Reporter());
}
 
Example #18
Source File: MissingInvocationChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public MissingInvocationChecker() {
    this(new InvocationsFinder(), new Reporter());
}
 
Example #19
Source File: MissingInvocationChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public MissingInvocationChecker() {
    this(new InvocationsFinder(), new Reporter());
}
 
Example #20
Source File: MissingInvocationChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
MissingInvocationChecker(InvocationsFinder finder, Reporter reporter) {
    this.finder = finder;
    this.reporter = reporter;
}
 
Example #21
Source File: MissingInvocationInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
MissingInvocationInOrderChecker(InvocationsFinder finder, Reporter reporter) {
    this.finder = finder;
    this.reporter = reporter;
}
 
Example #22
Source File: MissingInvocationInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public MissingInvocationInOrderChecker() {
    this(new InvocationsFinder(), new Reporter());
}
 
Example #23
Source File: NumberOfInvocationsChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
NumberOfInvocationsChecker(Reporter reporter, InvocationsFinder finder) {
    this.reporter = reporter;
    this.finder = finder;
}
 
Example #24
Source File: NumberOfInvocationsChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public NumberOfInvocationsChecker() {
    this(new Reporter(), new InvocationsFinder());
}
 
Example #25
Source File: NumberOfInvocationsInOrderChecker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
NumberOfInvocationsInOrderChecker(InvocationsFinder finder, Reporter reporter) {
    this.finder = finder;
    this.reporter = reporter;
}