Class FileExists

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

    public class FileExists
    extends org.hamcrest.TypeSafeMatcher<Path>
    Matcher that matches if the examined Path does or does not exist.
    • 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>
      • exists

        public static org.hamcrest.Matcher<Path> exists()
        Creates a matcher that matches if the examined Path exists.

        For example:

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

        public static org.hamcrest.Matcher<Path> notExists()
        Creates a matcher that matches if the examined Path does not exist.

        For example:

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