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

项目:docker-compose-rule    文件:ContainerIntegrationTests.java   
/**
 * 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());
}
项目:docker-compose-rule    文件:DockerComposeRuleNativeHealthcheckIntegrationTest.java   
/**
 * 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 dockerComposeRuleWaitsUntilHealthcheckPasses()
        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)));

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

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

    // The "dummy" 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 "dummy" container should make its healthcheck pass
    rule.dockerCompose().exec(noOptions(), "dummy", arguments("touch", "healthy"));
    await().until(container::state, Matchers.equalTo(State.HEALTHY));
    getUninterruptibly(beforeFuture, 1, TimeUnit.SECONDS);
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}