@Test
  public void testPaths_relativize() {
    assertThatPath(path("/foo/bar").relativize(path("/foo/bar/baz")))
        .isRelative()
        .and()
        .hasNameComponents("baz");
    assertThatPath(path("/foo/bar/baz").relativize(path("/foo/bar")))
        .isRelative()
        .and()
        .hasNameComponents("..");
    assertThatPath(path("/foo/bar/baz").relativize(path("/foo/baz/bar")))
        .isRelative()
        .and()
        .hasNameComponents("..", "..", "baz", "bar");
    assertThatPath(path("foo/bar").relativize(path("foo")))
        .isRelative()
        .and()
        .hasNameComponents("..");
    assertThatPath(path("foo").relativize(path("foo/bar")))
        .isRelative()
        .and()
        .hasNameComponents("bar");

    try {
      Path unused = path("/foo/bar").relativize(path("bar"));
      fail();
    } catch (IllegalArgumentException expected) {
    }

    try {
      Path unused = path("bar").relativize(path("/foo/bar"));
      fail();
    } catch (IllegalArgumentException expected) {
    }
  }
Tests an in-memory file system through the public APIs in {@link Files}, etc. This also acts as
the tests for {@code FileSystemView}, as each public API method is (mostly) implemented by a
method in {@code FileSystemView}.

<p>These tests uses a Unix-like file system, but most of what they test applies to any file
system configuration.

@author Colin Decker
jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java