Examples of StringDescription


Examples of org.hamcrest.StringDescription

        matcher = new HasJsonArray("array", new WithSize(is(2)));
    }
   
    @Test
    public void matcherShouldDescribeItselfCorrectly() {
        Description description = new StringDescription();
        matcher.describeTo(description);
       
        assertThat(description.toString(), is("JsonNode with 'array' matching: A JSON array with size: is <2>"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        matcher = new ContainingValue(containsString("joy"));
    }
   
    @Test
    public void matcherShouldDescribesItselfCorrectly() {
        Description description = new StringDescription();
        matcher.describeTo(description);
        assertThat(description.toString(), is("A JSON array containing: a string containing \"joy\""));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

    public ExpectedException thrown = ExpectedException.none();
   
    @Test
    public void matcherShouldDescribeItselfCorrectly() {
        HasJsonWhich matcher = new HasJsonWhich(new HasJsonValue("number", new IsEqual<Integer>(1)));
        Description description = new StringDescription();
        matcher.describeTo(description);
        assertThat(description.toString(), is("JsonNode with 'number' matching: <1>"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

    }
   
    @Test
    public void matcherShouldDescribeMismatchCorrectly() {
        HasJsonWhich matcher = new HasJsonWhich(new HasJsonValue("number", new IsEqual<Integer>(1)));
        Description description = new StringDescription();
        matcher.describeMismatchSafely("{\"number\":10}", description);
        assertThat(description.toString(), is("was <{\"number\":10}>"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        matcher = new HasResponseBody(containsString("something"));
    }
   
    @Test
    public void matcherDescribesItselfCorrectly() {
        Description description = new StringDescription();
        matcher.describeTo(description);
       
        assertThat(description.toString(), is("Response with body matching: a string containing \"something\""));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        assertThat(new Rfc1123DateMatcher().matches(unCompliantDate), is(false));
    }
   
    @Test
    public void testDescription() {
        Description description = new StringDescription();
        new Rfc1123DateMatcher().describeTo(description);
       
        assertThat(description.toString(), is("Rfc1123-compliant date in header, like 'Mon, 09 May 2011 18:49:18 GMT'"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        matcher = new HasHeader("Header");
    }
   
    @Test
    public void matcherShouldDescribeItselfCorrectly() {
        Description description = new StringDescription();
        matcher.describeTo(description);
       
        assertThat(description.toString(), is("Response with header named 'Header'"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        assertThat(matcher.matches(mockResponse), is(true));
    }
   
    @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

Examples of org.hamcrest.StringDescription

    }
   
    @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

Examples of org.hamcrest.StringDescription

    }
   
    @Test
    public void descriptionIsSufficient() {
       
        Description description = new StringDescription();
       
        matcher.describeTo(description);
       
        assertThat(description.toString(), is("Response with status code matching: <200>"));
       
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.