org.mockito.internal.verification.api.VerificationData#getWanted ( )源码实例Demo

下面列出了org.mockito.internal.verification.api.VerificationData#getWanted ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: che   文件: ConcurrentCompositeLineConsumerTest.java
public void verify(VerificationData verificationData) {
  List<Invocation> invocations = verificationData.getAllInvocations();
  InvocationMatcher invocationMatcher = verificationData.getWanted();

  if (invocations == null || invocations.isEmpty()) {
    throw new MockitoException(
        "\nNo interactions with "
            + invocationMatcher.getInvocation().getMock()
            + " mock so far");
  }
  Invocation invocation = invocations.get(invocations.size() - 1);

  if (!invocationMatcher.matches(invocation)) {
    throw new MockitoException("\nWanted but not invoked:\n" + invocationMatcher);
  }
}
 
源代码2 项目: astor   文件: AtMost.java
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);
}
 
源代码3 项目: astor   文件: Only.java
@SuppressWarnings("unchecked")
   public void verify(VerificationData data) {
	InvocationMatcher wantedMatcher = data.getWanted();
	List<Invocation> invocations = data.getAllInvocations();
	List<Invocation> chunk = finder.findInvocations(invocations,wantedMatcher);
	if (invocations.size() != 1 && chunk.size() > 0) {			
		Invocation unverified = finder.findFirstUnverified(invocations);
		reporter.noMoreInteractionsWanted(unverified, (List) invocations);
	} else if (invocations.size() != 1 || chunk.size() == 0) {
		reporter.wantedButNotInvoked(wantedMatcher);
	}
	marker.markVerified(chunk.get(0), wantedMatcher);
}
 
源代码4 项目: astor   文件: AtMost.java
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);
}
 
源代码5 项目: astor   文件: Only.java
@SuppressWarnings("unchecked")
   public void verify(VerificationData data) {
	InvocationMatcher wantedMatcher = data.getWanted();
	List<Invocation> invocations = data.getAllInvocations();
	List<Invocation> chunk = finder.findInvocations(invocations,wantedMatcher);
	if (invocations.size() != 1 && chunk.size() > 0) {			
		Invocation unverified = finder.findFirstUnverified(invocations);
		reporter.noMoreInteractionsWanted(unverified, (List) invocations);
	} else if (invocations.size() != 1 || chunk.size() == 0) {
		reporter.wantedButNotInvoked(wantedMatcher);
	}
	marker.markVerified(chunk.get(0), wantedMatcher);
}
 
源代码6 项目: Volley-Ball   文件: LastInteraction.java
@Override
public void verify(VerificationData data) {
    List<Invocation> invocations = data.getAllInvocations();
    InvocationMatcher matcher = data.getWanted();
    Invocation invocation = invocations.get(invocations.size() - 1);

    if (!matcher.matches(invocation)) {
        throw new MockitoException("This is not the last interaction with the mock object");
    }
}
 
源代码7 项目: astor   文件: InOrderWrapper.java
public void verify(VerificationData data) {
    List<Invocation> allInvocations = new AllInvocationsFinder().find(inOrder.getMocksToBeVerifiedInOrder());
    VerificationDataInOrderImpl dataInOrder = new VerificationDataInOrderImpl(inOrder, allInvocations, data.getWanted());
    mode.verifyInOrder(dataInOrder);
}
 
源代码8 项目: astor   文件: InOrderWrapper.java
public void verify(VerificationData data) {
    List<Invocation> invocations = new VerifiableInvocationsFinder().find(inOrder.getMocksToBeVerifiedInOrder());
    VerificationDataInOrderImpl dataInOrder = new VerificationDataInOrderImpl(inOrder, invocations, data.getWanted());
    mode.verifyInOrder(dataInOrder);
}