当前位置: 首页>>代码示例>>Java>>正文


Java VerificationData类代码示例

本文整理汇总了Java中org.mockito.internal.verification.api.VerificationData的典型用法代码示例。如果您正苦于以下问题:Java VerificationData类的具体用法?Java VerificationData怎么用?Java VerificationData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VerificationData类属于org.mockito.internal.verification.api包,在下文中一共展示了VerificationData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runImage_withStandaloneImage_shouldStartDockerContainer

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@Test
public void runImage_withStandaloneImage_shouldStartDockerContainer() throws IOException, InterruptedException, DockerClient.DockerClientException {
    DockerClient client = new DockerClient(build,launcher,listener);

    client.runImage("imagename","containername");

    verify(launcher, new VerificationMode() {

        public void verify(VerificationData verificationData) {
            assertEquals(verificationData.getAllInvocations().size(),1);
            Launcher.ProcStarter ps = (Launcher.ProcStarter) verificationData.getAllInvocations().get(0).getRawArguments()[0];
            String cmd = StringUtils.join(ps.cmds()," ");
            assertEquals("docker run -d --name containername imagename",cmd);
        }
    }).launch(Matchers.<Launcher.ProcStarter>any());
}
 
开发者ID:DevOnGlobal,项目名称:testgrid-plugin,代码行数:17,代码来源:DockerClientTest.java

示例2: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
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);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ConcurrentCompositeLineConsumerTest.java

示例3: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
public void verify(final VerificationData data) {
    int soFar = 0;
    AssertionError error = null;
    while (soFar <= timeout) {
        //noinspection ErrorNotRethrown
        try {
            delegate.verify(data);
            return;
        } catch (final AssertionError e) {
            error = e;
            soFar += treshhold;
            sleep(treshhold);
        }
    }
    if (error != null) {
        throw error;
    }
}
 
开发者ID:tomtom-international,项目名称:speedtools,代码行数:19,代码来源:VerificationWithTimeoutImpl.java

示例4: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
public void verify(VerificationData data) {
    int soFar = 0;
    MockitoAssertionError error = null;
    while (soFar <= timeout) {
        try {
            delegate.verify(data);
            return;
        } catch (MockitoAssertionError e) {
            error = e;
            soFar += treshhold;
            sleep(treshhold);
        }
    }
    if (error != null) {
        throw error;
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:VerificationWithTimeoutImpl.java

示例5: runImage_withHub_shouldStartDockerContainer

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@Test
public void runImage_withHub_shouldStartDockerContainer() throws IOException, InterruptedException, DockerClient.DockerClientException {
    DockerClient client = new DockerClient(build,launcher,listener);

    client.runImage("imagename","containername","linkimage","linkname");

    verify(launcher, new VerificationMode() {
        public void verify(VerificationData verificationData) {
            assertEquals(verificationData.getAllInvocations().size(),1);
            Launcher.ProcStarter ps = (Launcher.ProcStarter) verificationData.getAllInvocations().get(0).getRawArguments()[0];
            String cmd = StringUtils.join(ps.cmds()," ");
            assertEquals("docker run -d --name containername --link linkimage:linkname imagename",cmd);
        }
    }).launch(Matchers.<Launcher.ProcStarter>any());
}
 
开发者ID:DevOnGlobal,项目名称:testgrid-plugin,代码行数:16,代码来源:DockerClientTest.java

示例6: killImage__shouldKillDockerContainer

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@Test
public void killImage__shouldKillDockerContainer() throws IOException, InterruptedException, DockerClient.DockerClientException {
    DockerClient client = new DockerClient(build,launcher,listener);

    client.killImage("containername");
    verify(launcher, new VerificationMode() {

        public void verify(VerificationData verificationData) {
            assertEquals(verificationData.getAllInvocations().size(), 1);
            Launcher.ProcStarter ps = (Launcher.ProcStarter) verificationData.getAllInvocations().get(0).getRawArguments()[0];
            String cmd = StringUtils.join(ps.cmds(), " ");
            assertEquals("docker kill containername", cmd);
        }
    }).launch(Matchers.<Launcher.ProcStarter>any());
}
 
开发者ID:DevOnGlobal,项目名称:testgrid-plugin,代码行数:16,代码来源:DockerClientTest.java

示例7: rmImage__shouldRemoveDockerContainer

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@Test
public void rmImage__shouldRemoveDockerContainer() throws IOException, InterruptedException, DockerClient.DockerClientException {
    DockerClient client = new DockerClient(build,launcher,listener);

    client.rmImage("containername");
    verify(launcher, new VerificationMode() {

        public void verify(VerificationData verificationData) {
            assertEquals(verificationData.getAllInvocations().size(), 1);
            Launcher.ProcStarter ps = (Launcher.ProcStarter) verificationData.getAllInvocations().get(0).getRawArguments()[0];
            String cmd = StringUtils.join(ps.cmds(), " ");
            assertEquals("docker rm containername", cmd);
        }
    }).launch(Matchers.<Launcher.ProcStarter>any());
}
 
开发者ID:DevOnGlobal,项目名称:testgrid-plugin,代码行数:16,代码来源:DockerClientTest.java

示例8: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:AtMost.java

示例9: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void verify(VerificationData data) {
    Invocation unverified = new InvocationsFinder().findFirstUnverified(data.getAllInvocations());                       
    if (unverified != null) {
        new Reporter().noMoreInteractionsWanted(unverified, (List) data.getAllInvocations());
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:NoMoreInteractions.java

示例10: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
public void verify(VerificationData data) {
    MissingInvocationChecker missingInvocation = new MissingInvocationChecker();
    AtLeastXNumberOfInvocationsChecker numberOfInvocations = new AtLeastXNumberOfInvocationsChecker();
    
    if (wantedCount == 1) {
        missingInvocation.check(data.getAllInvocations(), data.getWanted());
    }
    numberOfInvocations.check(data.getAllInvocations(), data.getWanted(), wantedCount);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:AtLeast.java

示例11: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
public void verify(VerificationData data) {
    if (wantedCount > 0) {
        MissingInvocationChecker missingInvocation = new MissingInvocationChecker();
        missingInvocation.check(data.getAllInvocations(), data.getWanted());
    }
    NumberOfInvocationsChecker numberOfInvocations = new NumberOfInvocationsChecker();
    numberOfInvocations.check(data.getAllInvocations(), data.getWanted(), wantedCount);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:Times.java

示例12: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:Only.java

示例13: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void verify(VerificationData data) {
    Invocation unverified = new InvocationsFinder().findFirstUnverified(data.getAllInvocations());
    if (unverified != null) {
        new Reporter().noMoreInteractionsWanted(unverified, (List) data.getAllInvocations());
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:NoMoreInteractions.java

示例14: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
/**
 * Verify the given ongoing verification data, and confirm that it satisfies the delegate verification mode
 * before the full duration has passed.
 *
 * In practice, this polls the delegate verification mode until it is satisfied. If it is not satisfied once
 * the full duration has passed, the last error returned by the delegate verification mode will be thrown
 * here in turn. This may be thrown early if the delegate is unsatisfied and the verification mode is known
 * to never recover from this situation (e.g. {@link AtMost}).
 *
 * If it is satisfied before the full duration has passed, behaviour is dependent on the returnOnSuccess parameter
 * given in the constructor. If true, this verification mode is immediately satisfied once the delegate is. If
 * false, this verification mode is not satisfied until the delegate is satisfied and the full time has passed.
 *
 * @throws MockitoAssertionError if the delegate verification mode does not succeed before the timeout
 */
public void verify(VerificationData data) {
    MockitoAssertionError error = null;
    
    long startTime = System.currentTimeMillis();
    while (System.currentTimeMillis() - startTime <= durationMillis) {
        try {
            delegate.verify(data);
            
            if (returnOnSuccess) {
                return;
            } else {
                error = null;
            }
        } catch (MockitoAssertionError e) {
            if (canRecoverFromFailure(delegate)) {
                error = e;
                sleep(pollingPeriodMillis);
            } else {
                throw e;
            }
        }
    }
    
    if (error != null) {
        throw error;
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:43,代码来源:VerificationOverTimeImpl.java

示例15: verify

import org.mockito.internal.verification.api.VerificationData; //导入依赖的package包/类
@Override
public void verify(final VerificationData data) {
    InvocationsFinder finder = new InvocationsFinder();
    List<Invocation> actualInvocations = finder.findInvocations(data.getAllInvocations(), data.getWanted());
    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();

}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:14,代码来源:ArgumentsExtractorVerifier.java


注:本文中的org.mockito.internal.verification.api.VerificationData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。