org.mockito.internal.matchers.GreaterOrEqual Java Examples

The following examples show how to use org.mockito.internal.matchers.GreaterOrEqual. 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: ContainerIntegrationTests.java    From docker-compose-rule with Apache License 2.0 6 votes vote down vote up
/**
 * 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());
}
 
Example #2
Source File: LocalDockerITCase.java    From docker-java-api with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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))
    );
}
 
Example #3
Source File: WordWrapLayoutIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 ) );
  }
}
 
Example #4
Source File: DockerComposeManagerNativeHealthcheckIntegrationTest.java    From docker-compose-rule with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: UnixDockerITCase.java    From docker-java-api with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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))
    );
}
 
Example #6
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #7
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #8
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #9
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #10
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #11
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #12
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #13
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #14
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #15
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #16
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #17
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #18
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #19
Source File: AdditionalMatchers.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}