@Test
  public void testLinkDirectory() {
    Directory newDir = createDirectory(10);

    assertThat(newDir.entryInParent()).isNull();
    assertThat(newDir.get(Name.SELF).file()).isEqualTo(newDir);
    assertThat(newDir.get(Name.PARENT)).isNull();
    assertThat(newDir.links()).isEqualTo(1);

    dir.link(Name.simple("foo"), newDir);

    assertThat(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir));
    assertThat(newDir.parent()).isEqualTo(dir);
    assertThat(newDir.entryInParent().name()).isEqualTo(Name.simple("foo"));
    assertThat(newDir.get(Name.SELF)).isEqualTo(entry(newDir, ".", newDir));
    assertThat(newDir.get(Name.PARENT)).isEqualTo(entry(newDir, "..", dir));
    assertThat(newDir.links()).isEqualTo(2);
  }
Tests for {@link Directory}.

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