### Question:
Directory extends File implements Iterable<DirectoryEntry> { public void link(Name name, File file) { DirectoryEntry entry = new DirectoryEntry(this, checkNotReserved(name, "link"), file); put(entry); file.linked(entry); } private  Directory(int id); private  Directory(int id, Name rootName); static Directory create(int id); static Directory createRoot(int id, Name name); DirectoryEntry entryInParent(); Directory parent(); boolean isEmpty(); @NullableDecl DirectoryEntry get(Name name); void link(Name name, File file); void unlink(Name name); ImmutableSortedSet<Name> snapshot(); @Override Iterator<DirectoryEntry> iterator();  }### Answer:
@Test public void testLink() { assertThat(dir.get(Name.simple("bar"))).isNull(); File bar = Directory.create(2); dir.link(Name.simple("bar"), bar); assertThat(dir.get(Name.simple("bar"))).isEqualTo(entry(dir, "bar", bar)); }