DirectoryEntry extends Entry { @Override public boolean hasUnavailableContent(List<Entry> entriesWithUnavailableContent) { for (Entry e : myChildren) { e.hasUnavailableContent(entriesWithUnavailableContent); } return !entriesWithUnavailableContent.isEmpty(); } DirectoryEntry(int id, String name);  DirectoryEntry(Stream s); @Override void write(Stream s); @Override boolean isDirectory(); @Override void addChild(Entry child); @Override void removeChild(Entry child); @Override List<Entry> getChildren(); @Override boolean hasUnavailableContent(List<Entry> entriesWithUnavailableContent); @Override DirectoryEntry copy(); @Override void collectDifferencesWith(Entry right, List<Difference> result);  }
@Test public void testHasUnavailableContent() { Entry dir = new DirectoryEntry(-1, "dir"); assertHasNoUnavailableContent(dir); dir.addChild(new FileEntry(1, "f", c("abc"), -1, false)); assertHasNoUnavailableContent(dir); FileEntry f1 = new FileEntry(2, "f1", new UnavailableContent(), -1, false); FileEntry f2 = new FileEntry(3, "f2", new UnavailableContent(), -1, false); DirectoryEntry subDir = new DirectoryEntry(-1, "subDir"); dir.addChild(subDir); dir.addChild(f1); subDir.addChild(f2); assertHasUnavailableContent(dir, f2, f1); assertHasUnavailableContent(subDir, f2); }