### Question:
Directory extends File implements Iterable<DirectoryEntry> { @VisibleForTesting void put(DirectoryEntry entry) { put(entry, false); } 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 testPutEntryForExistingNameIsIllegal() { dir.put(entry("foo")); try { dir.put(entry("foo")); fail(); } catch (IllegalArgumentException expected) { } }