package com.palantir.docker.compose.connection.waiting;

import org.junit.Test;

import static com.palantir.docker.compose.connection.waiting.SuccessOrFailureMatchers.failure;
import static com.palantir.docker.compose.connection.waiting.SuccessOrFailureMatchers.failureWithMessage;
import static com.palantir.docker.compose.connection.waiting.SuccessOrFailureMatchers.successful;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

public class SuccessOrFailureShould {
    @Test
    public void not_have_failed_if_actually_a_success() {
        assertThat(SuccessOrFailure.success(), is(successful()));
    }

    @Test
    public void have_failed_if_actually_a_failure() {
        assertThat(SuccessOrFailure.failure("oops"), is(failure()));
    }

    @Test
    public void return_the_failure_message_if_set() {
        assertThat(SuccessOrFailure.failure("oops"), is(failureWithMessage("oops")));
    }
}
@@ -426,16 +426,110 @@
 rtThat;%0A
+import static org.hamcrest.Matchers.both;%0Aimport static org.hamcrest.Matchers.containsString;%0A
 import s
@@ -1034,10 +1034,348 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void fail_from_an_exception() %7B%0A        Exception exception = new RuntimeException(%22oh no%22);%0A        assertThat(SuccessOrFailure.fromException(exception),%0A            is(failureWithMessage(both(%0A                containsString(%22RuntimeException%22)).and(%0A                containsString(%22oh no%22)%0A            ))));%0A    %7D
 %0A%7D

Test for fromException