Package org.hamcrest

Examples of org.hamcrest.StringDescription


    private String qualifiedMethodName() {
        return MockUtil.getMockName(mock) + "." + method.getName();
    }

    private String getArgumentsLine(List<Matcher> matchers) {
        Description result = new StringDescription();
        result.appendList("(", ", ", ");", matchers);
        return result.toString();
    }
View Full Code Here


        result.appendList("(", ", ", ");", matchers);
        return result.toString();
    }
   
    private String getArgumentsBlock(List<Matcher> matchers) {
        Description result = new StringDescription();
        result.appendList("(\n    ", ",\n    ", "\n);", matchers);
        return result.toString();
    }
View Full Code Here

   * @see org.junit.matchers.JUnitMatchers
   */
  public static <T> void assertThat(String reason, T actual,
      Matcher<T> matcher) {
    if (!matcher.matches(actual)) {
      Description description= new StringDescription();
      description.appendText(reason);
      description.appendText("\nExpected: ");
      description.appendDescriptionOf(matcher);
      description.appendText("\n     got: ");
      description.appendValue(actual);
      description.appendText("\n");
      throw new java.lang.AssertionError(description.toString());
    }
  }
View Full Code Here

                public Class type(Object candidate, Cardinality cardinality, Matcher matcher) {
                    return String.class;
                }

                public Object value(Object candidate, Cardinality cardinality, Matcher matcher, int numValid) {
                    StringDescription description = new StringDescription();
                    matcher.describeTo(description);
                    return description.toString();
                }
            };
        }
View Full Code Here

    public boolean matches(Object argument) {
        return hamcrestMatcher.matches(argument);
    }

    public void appendTo(StringBuffer buffer) {
        hamcrestMatcher.describeTo(new StringDescription(buffer));
    }
View Full Code Here

    public boolean eval(Object o) {
        return hamcrestMatcher.matches(o);
    }

    public StringBuffer describeTo(StringBuffer buffer) {
        hamcrestMatcher.describeTo(new StringDescription(buffer));
        return buffer;
    }
View Full Code Here

    public boolean matches(Object argument) {
        return hamcrestMatcher.matches(argument);
    }

    public void appendTo(StringBuffer buffer) {
        hamcrestMatcher.describeTo(new StringDescription(buffer));
    }
View Full Code Here

    public boolean eval(Object o) {
        return hamcrestMatcher.matches(o);
    }

    public StringBuffer describeTo(StringBuffer buffer) {
        hamcrestMatcher.describeTo(new StringDescription(buffer));
        return buffer;
    }
View Full Code Here

        }
        return contextProperty;
    }

    private static <T> String descriptionOf(final Matcher<T> matcher) {
        final StringDescription stringDescription = new StringDescription();
        matcher.describeTo(stringDescription);
        final String description = stringDescription.toString();
        return description;
    }
View Full Code Here

        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

TOP

Related Classes of org.hamcrest.StringDescription

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.