@Test
  public void testSecureDirectoryStreamBasedOnRelativePath() throws IOException {
    Files.createDirectories(path("foo"));
    Files.createFile(path("foo/a"));
    Files.createFile(path("foo/b"));
    Files.createDirectory(path("foo/c"));
    Files.createFile(path("foo/c/d"));
    Files.createFile(path("foo/c/e"));

    try (DirectoryStream<Path> stream = Files.newDirectoryStream(path("foo"))) {
      SecureDirectoryStream<Path> secureStream = (SecureDirectoryStream<Path>) stream;

      assertThat(ImmutableList.copyOf(secureStream))
          .containsExactly(path("foo/a"), path("foo/b"), path("foo/c"));

      try (DirectoryStream<Path> stream2 = secureStream.newDirectoryStream(path("c"))) {
        assertThat(ImmutableList.copyOf(stream2)).containsExactly(path("foo/c/d"), path("foo/c/e"));
      }
    }
  }
");
    assertThatPath("foo/bar").doesNotMatch("glob:/**");
    assertThatPath("/foo/bar/baz/stuff").matches("glob:/foo/**");
    assertThatPath("/foo/bar/baz/stuff").matches("glob:/*
jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java