Package com.github.restdriver.serverdriver.http.response

Examples of com.github.restdriver.serverdriver.http.response.Response


    }
   
    @Test
    public void matcherShouldDescribeMismatchCorrectlyWithNoHeaders() {
        Description description = new StringDescription();
        Response mockResponse = mock(Response.class);
        matcher.describeMismatchSafely(mockResponse, description);
       
        assertThat(description.toString(), is("Response has no headers"));
    }
View Full Code Here


   
    @Test
    public void matcherShouldDescribeMismatchCorrectlyWithHeaders() {
        List<Header> headers = Arrays.asList(new Header("This: that"), new Header("The: other"));
        Description description = new StringDescription();
        Response mockResponse = mock(Response.class);
        when(mockResponse.getHeaders()).thenReturn(headers);
        matcher.describeMismatchSafely(mockResponse, description);
       
        assertThat(description.toString(), is("Response has headers [This: that, The: other]"));
    }
View Full Code Here

        assertThat(description.toString(), is("Response with header named 'Content-Type' and value matching: a string containing \"application/json\""));
    }
   
    @Test
    public void matcherShouldFailIfResponseDoesntHaveHeaders() {
        Response mockResponse = mock(Response.class);
       
        assertThat(matcher.matches(mockResponse), is(false));
    }
View Full Code Here

        assertThat(matcher.matches(mockResponse), is(false));
    }
   
    @Test
    public void matcherShouldFailIfMatcherDoesntMatch() {
        Response mockResponse = mock(Response.class);
        when(mockResponse.getHeaders()).thenReturn(Arrays.asList(new Header("Content-Type", "text/xml")));
       
        assertThat(matcher.matches(mockResponse), is(false));
    }
View Full Code Here

        assertThat(matcher.matches(mockResponse), is(false));
    }
   
    @Test
    public void matcherShouldPassIfMatcherMatches() {
        Response mockResponse = mock(Response.class);
        when(mockResponse.getHeaders()).thenReturn(Arrays.asList(new Header("Content-Type", "application/json;charset=UTF-8")));
       
        assertThat(matcher.matches(mockResponse), is(true));
    }
View Full Code Here

        assertThat(matcher.matches(mockResponse), is(true));
    }
   
    @Test
    public void matcherShouldDescribeMismatchCorrectlyIfResponseHasNoHeaders() {
        Response mockResponse = mock(Response.class);
        Description description = new StringDescription();
        matcher.describeMismatchSafely(mockResponse, description);
       
        assertThat(description.toString(), is("Response has no headers"));
    }
View Full Code Here

        assertThat(description.toString(), is("Response has no headers"));
    }
   
    @Test
    public void matcherShouldDescribeMismatchCorrectlyIfResponseHasHeaders() {
        Response mockResponse = mock(Response.class);
        when(mockResponse.getHeaders()).thenReturn(Arrays.asList(new Header("Header1: value"), new Header("Header2: value")));
        Description description = new StringDescription();
        matcher.describeMismatchSafely(mockResponse, description);
       
        assertThat(description.toString(), is("Response has headers [Header1: value, Header2: value]"));
    }
View Full Code Here

public class ConfigAT {
   
    @Test
    public void getAcceptanceTestSeyrenConfig() {
        Response response = get(config());
        assertThat(response, hasStatusCode(200));
       
        // Base
        assertThat(response.asJson().size(), is(3));
        assertThat(response.asJson(), hasJsonPath("$.baseUrl", not(isEmptyOrNullString())));
        assertThat(response.asJson(), hasJsonPath("$.graphiteCarbonPickleEnabled", is(false)));
        assertThat(response.asJson(), hasJsonPath("$.graphsEnabled", is(true)));
    }
View Full Code Here

public class AlertsAT {
   
    @Test
    public void testGetAlertsReturnsOk() {
        Response response = get(alerts("1"));
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(0)));
        assertThat(response.asJson(), hasJsonPath("$.items", is(20)));
        assertThat(response.asJson(), hasJsonPath("$.start", is(0)));
        assertThat(response.asJson(), hasJsonPath("$.total", is(0)));
    }
View Full Code Here

        assertThat(response.asJson(), hasJsonPath("$.total", is(0)));
    }
   
    @Test
    public void testGetAlertsInvalidStart() {
        Response response = get(alerts("1").withParam("start", "-1"));
        assertThat(response, hasStatusCode(400));
    }
View Full Code Here

TOP

Related Classes of com.github.restdriver.serverdriver.http.response.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.