Examples of StringDescription


Examples of org.hamcrest.StringDescription

        assertThat(hasSameNumberOfRowAs(sheetWithThreeRows).matches(sheetWithTwoRows), is(false));
    }

    @Test
    public void description() {
        Description description = new StringDescription();
        hasSameNumberOfRowAs(sheetWithThreeRows).describeTo(description);
        assertThat(description.toString(), is("<3> row(s) in sheet \"Sheet1\""));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        assertThat(description.toString(), is("<3> row(s) in sheet \"Sheet1\""));
    }

    @Test
    public void mismatch() {
        Description description = new StringDescription();
        hasSameNumberOfRowAs(sheetWithThreeRows).matchesSafely(sheetWithTwoRows, description);
        assertThat(description.toString(), is("got <2> row(s) in sheet \"Sheet1\" expected <3>"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        assertThat(hasSameNumberOfCellsAs(rowWithThreeCells).matches(rowWithTwoCells), is(false));
    }

    @Test
    public void description() {
        Description description = new StringDescription();
        hasSameNumberOfCellsAs(rowWithThreeCells).describeTo(description);
        assertThat(description.toString(), is("<3> cell(s) on row <1>"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        assertThat(description.toString(), is("<3> cell(s) on row <1>"));
    }

    @Test
    public void mismatch() {
        Description description = new StringDescription();
        hasSameNumberOfCellsAs(rowWithThreeCells).matchesSafely(rowWithTwoCells, description);
        assertThat(description.toString(), is("got <2> cell(s) on row <1> expected <3>"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

            String actualContent = new String(realRequest.getBodyContent());
           
            boolean hasMatchingBodyContent = expectedRequest.getBodyContentMatcher().matches(actualContent);
           
            if (!hasMatchingBodyContent) {
                StringDescription description = new StringDescription();
                expectedRequest.getBodyContentMatcher().describeTo(description);
                description.appendText(" ");
                expectedRequest.getBodyContentMatcher().describeMismatch(actualContent, description);
                LOGGER.info("({} {}) REJECTED on content: Expected {}", realRequest.getMethod(), realRequest.getPath(), description.toString());
                return false;
            }
           
        }
       
View Full Code Here

Examples of org.hamcrest.StringDescription

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

Examples of org.hamcrest.StringDescription

    @Test
    public void describeToDoesntThrowNPE() {
        // bugfix for issue #47
       
        hasJsonPath = new HasJsonPath<Object>("$.foo");
        StringDescription sd = new StringDescription();
        hasJsonPath.describeTo(sd);
       
        assertThat(sd.toString(), is("a JSON object matching JSONpath \"$.foo\""));
       
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

    }
   
    @Test
    public void descriptionIsSensible() {
        MatchesRegex matchesPattern = new MatchesRegex(Pattern.compile("je[f]{3}"));
        Description description = new StringDescription();
        matchesPattern.describeTo(description);
        assertThat(description.toString(), is("A string matching the regular expression: je[f]{3}"));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

    }
   
    @Test
    public void mismatchDescriptionIsSensible() {
        MatchesRegex matchesPattern = new MatchesRegex(Pattern.compile("je[f]{3}"));
        Description description = new StringDescription();
        matchesPattern.describeMismatch("jeff", description);
        assertThat(description.toString(), is("was \"jeff\""));
    }
View Full Code Here

Examples of org.hamcrest.StringDescription

        matcher = new WithValueAt(1, is("bar"));
    }
   
    @Test
    public void matcherDescribesItselfCorrectly() {
        Description description = new StringDescription();
        matcher.describeTo(description);
       
        assertThat(description.toString(), is("A JSON array with value at 1 which matches: is \"bar\""));
    }
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.