### Question:
Directory extends File implements Iterable<DirectoryEntry> { public void unlink(Name name) { DirectoryEntry entry = remove(checkNotReserved(name, "unlink")); entry.file().unlinked(); } 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 testUnlink() { assertThat(root.get(Name.simple("foo"))).isNotNull(); root.unlink(Name.simple("foo")); assertThat(root.get(Name.simple("foo"))).isNull(); }
@Test public void testUnlink_nonExistentNameFails() { try { dir.unlink(Name.simple("bar")); fail(); } catch (IllegalArgumentException expected) { } }
@Test public void testUnlink_parentAndSelfNameFails() { try { dir.unlink(Name.simple(".")); fail(); } catch (IllegalArgumentException expected) { } try { dir.unlink(Name.simple("..")); fail(); } catch (IllegalArgumentException expected) { } }