@Override
    public void chunk(final Path directory, final AttributedList<Path> list) throws ListCanceledException {
        if(directory.isRoot()) {
            if(list.size() >= container) {
                // Allow another chunk until limit is reached again
                container += preferences.getInteger("browser.list.limit.container");
                throw new ListCanceledException(list);
            }
        }
        if(list.size() >= this.directory) {
            // Allow another chunk until limit is reached again
            this.directory += preferences.getInteger("browser.list.limit.directory");
            throw new ListCanceledException(list);
        }
    }
@Test(expected = ListCanceledException.class)
    public void testChunkLimitFolder() throws Exception {
        new LimitedListProgressListener(new DisabledProgressListener()).chunk(
                new Path("/container", EnumSet.of(Path.Type.volume, Path.Type.directory)), new AttributedList<Path>() {
                    @Override
                    public int size() {
                        return 10000;
                    }
                }

        );
    }