Class PathEndsWith

  • All Implemented Interfaces:
    org.hamcrest.Matcher<Path>, org.hamcrest.SelfDescribing

    public class PathEndsWith
    extends org.hamcrest.TypeSafeMatcher<Path>
    Matcher that matches if the examined Path ends with the given path part.
    • Method Detail

      • describeTo

        public void describeTo​(org.hamcrest.Description description)
      • describeMismatchSafely

        protected void describeMismatchSafely​(Path item,
                                              org.hamcrest.Description description)
        Overrides:
        describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<Path>
      • matchesSafely

        protected boolean matchesSafely​(Path path)
        Specified by:
        matchesSafely in class org.hamcrest.TypeSafeMatcher<Path>
      • endsWith

        public static org.hamcrest.Matcher<Path> endsWith​(Path part)
        Creates a matcher that matches if the examined Path ends with the given path part.

        For example:

         assertThat(Paths.get("path/to/some/file"), endsWith(Paths.get("some/file")))
         
      • endsWith

        public static org.hamcrest.Matcher<Path> endsWith​(String part)
        Creates a matcher that matches if the examined Path ends with the given path part.

        For example:

         assertThat(Paths.get("path/to/some/file"), endsWith("some/file"))