### Question:
DirectoryRepository implements DataRepository { @Override public Iterable<Handle<?>> query(Filter<? super Handle<?>> filter) throws IOException { CompositeFilenameFilter fileFilter = new CompositeFilenameFilter(); if (exts != null) { fileFilter.and(new ExtensionFilter(exts)); } Map<String,FileGroup> files = listFiles(fileFilter); LinkedHashSet<Handle<?>> items = new LinkedHashSet<Handle<?>>(); for (Map.Entry<String, FileGroup> e : files.entrySet()) { String name = e.getKey(); FileGroup grp = e.getValue(); Driver<?> drv = null; if (grp.hasMeta()) { Pair<Driver<?>,Map<String,Object>> meta = readMetaFile(grp); if (meta != null) { drv = meta.first; } } if (drv == null) { Iterator<File> it = grp.files().iterator(); while(drv == null && it.hasNext()) { drv = Drivers.find(it.next().toURI(), drivers); } } if (drv != null) { Handle<?> h = RepoHandle.to(name, handleType(drv), drv, this); if (filter.test(h)) { items.add(h); } } else { LOG.debug("unable to load driver for files: " + grp.files()); } } return items; } DirectoryRepository(File baseDir, String... exts);  DirectoryRepository(File baseDir, DriverRegistry drivers, String... exts); File getDirectory(); @Override Iterable<Handle<?>> query(Filter<? super Handle<?>> filter); @Override T get(final String key, Class<T> type); @Override void close();  }### Answer:
@Test public void testList() throws Exception { assertEquals(2, Iterables.size(repo.query(Filters.all()))); Handle<?> found = Iterables.find(repo.query(Filters.all()), new Predicate<Handle<?>>() { @Override public boolean apply(Handle<?> input) { return "foo".equals(input.name()) && Workspace.class.isAssignableFrom(input.type()); } }); assertNotNull(found); found = Iterables.find(repo.query(Filters.all()), new Predicate<Handle<?>>() { @Override public boolean apply(Handle<?> input) { return "bar".equals(input.name()) && Workspace.class.isAssignableFrom(input.type()); } }); assertNotNull(found); }