@Test public void createUsefulMessageWhenAsIntFailed() { thrown.expect(AssertionError.class); thrown.expectMessage("XML with XPath "string converted to java.lang.Integer <3>"); thrown.expectMessage("failed with java.lang.NumberFormatException: For input string: \"apple\""); String xml = "<fruits><fruit name=\"apple\"/></fruits>"; assertThat(xml, hasXPath(" }
@Factory public static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher) { return new IntegerTypeMatcher(valueMatcher); }
TypeMatcher extends TypeSafeMatcher<String> { @Factory public static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher) { return new IntegerTypeMatcher(valueMatcher); } }
TypeMatcher extends TypeSafeMatcher<String> { @Factory public static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher) { return new IntegerTypeMatcher(valueMatcher); } TypeMatcher(Class<T> clazz, Matcher<? extends T> valueMatcher); }
TypeMatcher extends TypeSafeMatcher<String> { @Factory public static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher) { return new IntegerTypeMatcher(valueMatcher); } TypeMatcher(Class<T> clazz, Matcher<? extends T> valueMatcher); @Override void describeTo(Description description); @Factory static TypeMatcher<BigDecimal> asBigDecimal(Matcher<? extends BigDecimal> valueMatcher); @Factory static TypeMatcher<Double> asDouble(Matcher<? extends Double> valueMatcher); @Factory static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher); @Factory static TypeMatcher<Boolean> asBoolean(Matcher<? extends Boolean> valueMatcher); }
TypeMatcher extends TypeSafeMatcher<String> { @Factory public static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher) { return new IntegerTypeMatcher(valueMatcher); } TypeMatcher(Class<T> clazz, Matcher<? extends T> valueMatcher); @Override void describeTo(Description description); @Factory static TypeMatcher<BigDecimal> asBigDecimal(Matcher<? extends BigDecimal> valueMatcher); @Factory static TypeMatcher<Double> asDouble(Matcher<? extends Double> valueMatcher); @Factory static TypeMatcher<Integer> asInt(Matcher<? extends Integer> valueMatcher); @Factory static TypeMatcher<Boolean> asBoolean(Matcher<? extends Boolean> valueMatcher);  }