package com.airhacks.breakr;

import static com.airhacks.rulz.jaxrsclient.HttpMatchers.successful;
import com.airhacks.rulz.jaxrsclient.JAXRSClientProvider;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.Rule;
import org.junit.Test;

/**
 *
 * @author airhacks.com
 */
public class BreakrIT {

    @Rule
    public JAXRSClientProvider provider = JAXRSClientProvider.buildWithURI("http://localhost:8080/breakr-st/resources/tests");

    @Test
    public void timeout() {
        WebTarget target = provider.target();
        Response response = target.
                path("slow").
                path("5").
                request().
                get(Response.class);
        assertThat(response, successful());
        String result = response.readEntity(String.class);
        assertTrue(result.isEmpty());

        //reset
        target.request().delete();
        result = target.
                path("slow").
                path("2").
                request().
                get(String.class);
        assertThat(result, startsWith("Slow"));
    }

    @Test
    public void brittle() {
        WebTarget target = provider.target();
        Response response = target.
                path("brittle").
                path("5").
                request().
                get(Response.class);
        assertThat(response, successful());
        String result = response.readEntity(String.class);
        assertThat(result, is("+"));
    }

}

package com.airhacks.breakr;

import static com.airhacks.rulz.jaxrsclient.HttpMatchers.successful;
import com.airhacks.rulz.jaxrsclient.JAXRSClientProvider;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.Rule;
import org.junit.Test;

/**
 *
 * @author airhacks.com
 */
public class BreakrIT {

    @Rule
    public JAXRSClientProvider provider = JAXRSClientProvider.buildWithURI("http://localhost:8080/breakr-st/resources/tests");

    @Test
    public void timeout() {
        WebTarget target = provider.target();
        Response response = target.
                path("slow").
                path("5").
                request().
                get(Response.class);
        assertThat(response, successful());
        String result = response.readEntity(String.class);
        assertTrue(result.isEmpty());

        //reset of other service shouldn't have any effect
        target.path("brittle").
                request().
                delete();

        result = target.
                path("slow").
                path("1").
                request().
                get(String.class);
        assertTrue(result.isEmpty());

        //reset
        target.path("slow").
                request().
                delete();

        result = target.
                path("slow").
                path("2").
                request().
                get(String.class);
        assertThat(result, startsWith("Slow"));
    }

    @Test
    public void brittle() {
        WebTarget target = provider.target();
        Response response = target.
                path("brittle").
                path("5").
                request().
                get(Response.class);
        assertThat(response, successful());
        String result = response.readEntity(String.class);
        assertThat(result, is("+"));
    }

}

Reset of "slow" tested