Package org.hamcrest

Examples of org.hamcrest.Description


        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


        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

        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

        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

        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

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

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

        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

        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

        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

TOP

Related Classes of org.hamcrest.Description

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.