Search in sources :

Example 61 with Description

use of org.hamcrest.Description in project JsonPath by jayway.

the class IsJsonFileTest method shouldBeDescriptive.

@Test
public void shouldBeDescriptive() {
    Matcher<File> matcher = isJsonFile(withPathEvaluatedTo(true));
    Description description = new StringDescription();
    matcher.describeTo(description);
    assertThat(description.toString(), startsWith("is json"));
    assertThat(description.toString(), containsString(MATCH_TRUE_TEXT));
}
Also used : Description(org.hamcrest.Description) StringDescription(org.hamcrest.StringDescription) StringDescription(org.hamcrest.StringDescription) File(java.io.File) JsonPathMatchers.isJsonFile(com.jayway.jsonpath.matchers.JsonPathMatchers.isJsonFile) ResourceHelpers.resourceAsFile(com.jayway.jsonpath.matchers.helpers.ResourceHelpers.resourceAsFile) Test(org.junit.Test)

Example 62 with Description

use of org.hamcrest.Description in project JsonPath by jayway.

the class IsJsonStringTest method shouldDescribeMismatchOfInvalidJson.

@Test
public void shouldDescribeMismatchOfInvalidJson() {
    Matcher<String> matcher = isJsonString(withPathEvaluatedTo(true));
    Description description = new StringDescription();
    matcher.describeMismatch("invalid-json", description);
    assertThat(description.toString(), containsString("\"invalid-json\""));
}
Also used : Description(org.hamcrest.Description) StringDescription(org.hamcrest.StringDescription) StringDescription(org.hamcrest.StringDescription) JsonPathMatchers.isJsonString(com.jayway.jsonpath.matchers.JsonPathMatchers.isJsonString) Test(org.junit.Test)

Example 63 with Description

use of org.hamcrest.Description in project JsonPath by jayway.

the class IsJsonStringTest method shouldBeDescriptive.

@Test
public void shouldBeDescriptive() {
    Matcher<String> matcher = isJsonString(withPathEvaluatedTo(true));
    Description description = new StringDescription();
    matcher.describeTo(description);
    assertThat(description.toString(), startsWith("is json"));
    assertThat(description.toString(), containsString(MATCH_TRUE_TEXT));
}
Also used : Description(org.hamcrest.Description) StringDescription(org.hamcrest.StringDescription) StringDescription(org.hamcrest.StringDescription) JsonPathMatchers.isJsonString(com.jayway.jsonpath.matchers.JsonPathMatchers.isJsonString) Test(org.junit.Test)

Example 64 with Description

use of org.hamcrest.Description in project JsonPath by jayway.

the class IsJsonTest method shouldDescribeMismatchOfValidJson.

@Test
public void shouldDescribeMismatchOfValidJson() {
    Matcher<Object> matcher = isJson(withPathEvaluatedTo(true));
    Description description = new StringDescription();
    matcher.describeMismatch(BOOKS_JSON_STRING, description);
    assertThat(description.toString(), containsString(TestingMatchers.MISMATCHED_TEXT));
}
Also used : Description(org.hamcrest.Description) StringDescription(org.hamcrest.StringDescription) StringDescription(org.hamcrest.StringDescription) Test(org.junit.Test)

Example 65 with Description

use of org.hamcrest.Description in project JsonPath by jayway.

the class IsJsonTest method shouldBeDescriptive.

@Test
public void shouldBeDescriptive() {
    Matcher<Object> matcher = isJson(withPathEvaluatedTo(true));
    Description description = new StringDescription();
    matcher.describeTo(description);
    assertThat(description.toString(), startsWith("is json"));
    assertThat(description.toString(), containsString(TestingMatchers.MATCH_TRUE_TEXT));
}
Also used : Description(org.hamcrest.Description) StringDescription(org.hamcrest.StringDescription) StringDescription(org.hamcrest.StringDescription) Test(org.junit.Test)

Aggregations

Description (org.hamcrest.Description)117 Test (org.junit.Test)37 TypeSafeMatcher (org.hamcrest.TypeSafeMatcher)35 StringDescription (org.hamcrest.StringDescription)26 BaseMatcher (org.hamcrest.BaseMatcher)25 View (android.view.View)22 ViewParent (android.view.ViewParent)11 TextView (android.widget.TextView)11 ViewGroup (android.view.ViewGroup)8 Expectations (org.jmock.Expectations)8 URL (java.net.URL)7 Matcher (org.hamcrest.Matcher)7 Invocation (org.jmock.api.Invocation)7 BoundedMatcher (android.support.test.espresso.matcher.BoundedMatcher)6 ImageView (android.widget.ImageView)6 File (java.io.File)6 IOException (java.io.IOException)6 URI (java.net.URI)6 List (java.util.List)6 JsonNode (org.codehaus.jackson.JsonNode)6