### Question:
PathMatcher extends TypeSafeDiagnosingMatcher<T> { @Factory public static <T,P> Matcher<T> hasValue(Path<P> path) { return new PathMatcher<T,P>(path, notNullValue()); } PathMatcher(Path<V> path, Matcher<? super V> matcher);  PathMatcher(Path<V> path, Matcher<? super V> matcher, Function<T, V> accessor); @Factory static Matcher<T> hasValue(Path<P> path); @Factory static Matcher<T> hasValue(Path<P> path, Matcher<? super P> matcher); @Override void describeTo(Description description);  }### Answer:
@Test public void match() { Car car = new Car(); car.setHorsePower(123); assertThat(car, hasValue($.horsePower)); assertThat(car, hasValue($.horsePower, equalTo(123))); }
@Test public void mismatch() { Car car = new Car(); car.setHorsePower(123); Description mismatchDescription = new StringDescription(); hasValue($.horsePower, equalTo(321)).describeMismatch(car, mismatchDescription); assertEquals("value \"car.horsePower\" was <123>", mismatchDescription.toString()); }