org.mockito.internal.matchers.GreaterOrEqual源码实例Demo

类org.mockito.internal.matchers.GreaterOrEqual源码实例Demo

下面列出了org.mockito.internal.matchers.GreaterOrEqual 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * This test is not currently enabled in Circle as it does not provide a sufficiently recent version of docker-compose.
 *
 * @see <a href="https://github.com/palantir/docker-compose-rule/issues/156">Issue #156</a>
 */
@Test
public void testStateChanges_withHealthCheck() throws IOException, InterruptedException {
    assumeThat("docker version", Docker.version(), new GreaterOrEqual<>(Version.forIntegers(1, 12, 0)));
    assumeThat("docker-compose version", DockerCompose.version(), new GreaterOrEqual<>(Version.forIntegers(1, 10, 0)));

    DockerCompose dockerCompose = new DefaultDockerCompose(
            DockerComposeFiles.from("src/test/resources/native-healthcheck.yaml"),
            dockerMachine,
            ProjectName.random());

    // The withHealthcheck service's healthcheck checks every 100ms whether the file "healthy" exists
    Container container = new Container("withHealthcheck", docker, dockerCompose);
    assertEquals(State.DOWN, container.state());
    container.up();
    assertEquals(State.UNHEALTHY, container.state());
    dockerCompose.exec(noOptions(), "withHealthcheck", arguments("touch", "healthy"));
    wait.until(container::state, equalTo(State.HEALTHY));
    dockerCompose.exec(noOptions(), "withHealthcheck", arguments("rm", "healthy"));
    wait.until(container::state, equalTo(State.UNHEALTHY));
    container.kill();
    assertEquals(State.DOWN, container.state());
}
 
源代码2 项目: docker-java-api   文件: UnixDockerITCase.java
/**
 * UnixDocker can list {@link Volumes}.
 * @throws Exception If something goes wrong.
 */
@Test
public void listVolumes() throws Exception {
    final Docker docker = new UnixDocker(
        Paths.get("/var/run/docker.sock").toFile()
    );
    MatcherAssert.assertThat(
        docker.volumes(),
        new IsIterableWithSize<>(new GreaterOrEqual<>(0))
    );
}
 
源代码3 项目: docker-java-api   文件: LocalDockerITCase.java
/**
 * LocalUnixDocker can list {@link Volumes}.
 * @throws Exception If something goes wrong.
 */
@Test
public void listVolumes() throws Exception {
    final Docker docker = new LocalDocker(
        Paths.get("/var/run/docker.sock").toFile()
    );
    MatcherAssert.assertThat(
        docker.volumes(),
        new IsIterableWithSize<>(new GreaterOrEqual<>(0))
    );
}
 
/**
 * This test is not currently enabled in Circle as it does not provide a sufficiently recent version of docker-compose.
 *
 * @see <a href="https://github.com/palantir/docker-compose-rule/issues/156">Issue #156</a>
 */
@Test
public void dockerComposeManagerWaitsUntilHealthcheckPasses()
        throws ExecutionException, IOException, InterruptedException, TimeoutException {
    assumeThat("docker version", Docker.version(), new GreaterOrEqual<>(Version.forIntegers(1, 12, 0)));
    assumeThat("docker-compose version", DockerCompose.version(), new GreaterOrEqual<>(Version.forIntegers(1, 10, 0)));

    docker = new DockerComposeManager.Builder()
            .file("src/test/resources/native-healthcheck.yaml")
            .build();
    Future<?> beforeFuture = pool.submit(() -> {
        docker.before();
        return null;
    });

    Container container = docker.containers().container("withHealthcheck");
    await().until(container::state, Matchers.equalTo(State.UNHEALTHY));

    // The "withHealthCheck" container should not initially pass its healthcheck
    try {
        getUninterruptibly(beforeFuture, 1, TimeUnit.SECONDS);
        fail("Expected before() to wait");
    } catch (TimeoutException e) {
        // Expected
    }

    // Touching the "healthy" file in the "withHealthCheck" container should make its healthcheck pass
    docker.dockerCompose().exec(noOptions(), "withHealthcheck", arguments("touch", "healthy"));
    await().until(container::state, Matchers.equalTo(State.HEALTHY));
    getUninterruptibly(beforeFuture, 1, TimeUnit.SECONDS);
}
 
源代码5 项目: pentaho-reporting   文件: WordWrapLayoutIT.java
private void assertTextNodesLayInsideBoxBounds( RenderBox box, List<RenderableText> texts ) {
  assertFalse( texts.isEmpty() );

  GreaterOrEqual<Long> greaterThanBoxX = new GreaterOrEqual<Long>( box.getX() );
  LessOrEqual<Long> lessThanBoxWidth = new LessOrEqual<Long>( box.getWidth() );
  for ( RenderableText text : texts ) {
    assertThat( text.getX(), is( greaterThanBoxX ) );
    assertThat( text.getWidth(), is( lessThanBoxWidth ) );
  }
}
 
源代码6 项目: astor   文件: AdditionalMatchers.java
/**
 * argument greater than or equal the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>null</code>.
 */
public static <T extends Comparable<T>> T geq(Comparable<T> value) {
    return reportMatcher(new GreaterOrEqual<T>(value)).<T>returnNull();
}
 
源代码7 项目: astor   文件: AdditionalMatchers.java
/**
 * byte argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static byte geq(byte value) {
    return reportMatcher(new GreaterOrEqual<Byte>(value)).returnZero();
}
 
源代码8 项目: astor   文件: AdditionalMatchers.java
/**
 * double argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static double geq(double value) {
    return reportMatcher(new GreaterOrEqual<Double>(value)).returnZero();
}
 
源代码9 项目: astor   文件: AdditionalMatchers.java
/**
 * float argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static float geq(float value) {
    return reportMatcher(new GreaterOrEqual<Float>(value)).returnZero();
}
 
源代码10 项目: astor   文件: AdditionalMatchers.java
/**
 * int argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static int geq(int value) {
    return reportMatcher(new GreaterOrEqual<Integer>(value)).returnZero();
}
 
源代码11 项目: astor   文件: AdditionalMatchers.java
/**
 * long argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static long geq(long value) {
    return reportMatcher(new GreaterOrEqual<Long>(value)).returnZero();
}
 
源代码12 项目: astor   文件: AdditionalMatchers.java
/**
 * short argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static short geq(short value) {
    return reportMatcher(new GreaterOrEqual<Short>(value)).returnZero();
}
 
源代码13 项目: astor   文件: AdditionalMatchers.java
/**
 * argument greater than or equal the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>null</code>.
 */
public static <T extends Comparable<T>> T geq(Comparable<T> value) {
    return reportMatcher(new GreaterOrEqual<T>(value)).<T>returnNull();
}
 
源代码14 项目: astor   文件: AdditionalMatchers.java
/**
 * byte argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static byte geq(byte value) {
    return reportMatcher(new GreaterOrEqual<Byte>(value)).returnZero();
}
 
源代码15 项目: astor   文件: AdditionalMatchers.java
/**
 * double argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static double geq(double value) {
    return reportMatcher(new GreaterOrEqual<Double>(value)).returnZero();
}
 
源代码16 项目: astor   文件: AdditionalMatchers.java
/**
 * float argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static float geq(float value) {
    return reportMatcher(new GreaterOrEqual<Float>(value)).returnZero();
}
 
源代码17 项目: astor   文件: AdditionalMatchers.java
/**
 * int argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static int geq(int value) {
    return reportMatcher(new GreaterOrEqual<Integer>(value)).returnZero();
}
 
源代码18 项目: astor   文件: AdditionalMatchers.java
/**
 * long argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static long geq(long value) {
    return reportMatcher(new GreaterOrEqual<Long>(value)).returnZero();
}
 
源代码19 项目: astor   文件: AdditionalMatchers.java
/**
 * short argument greater than or equal to the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>0</code>.
 */
public static short geq(short value) {
    return reportMatcher(new GreaterOrEqual<Short>(value)).returnZero();
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类所在包
 类方法
 同包方法