@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        // Must split otherwise 413 Request Entity Too Large is returned
        for(List<Path> partition : new Partition<>(new ArrayList<>(files.keySet()),
                new HostPreferences(session.getHost()).getInteger("googledrive.delete.multiple.partition"))) {
            final BatchRequest batch = session.getClient().batch();
            final List<BackgroundException> failures = new CopyOnWriteArrayList<>();
            for(Path file : partition) {
                try {
                    this.queue(file, batch, callback, failures);
                }
                catch(IOException e) {
                    throw new DriveExceptionMappingService(fileid).map("Cannot delete {0}", e, file);
                }
            }
            if(!partition.isEmpty()) {
                try {
                    batch.execute();
                }
                catch(IOException e) {
                    throw new DriveExceptionMappingService(fileid).map(e);
                }
                for(BackgroundException e : failures) {
                    throw e;
                }
            }
        }
    }
@Test
    public void testDeleteMultipleFiles() throws Exception {
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        final Path folder = new DriveDirectoryFeature(session, fileid).mkdir(new Path(DriveHomeFinderService.MYDRIVE_FOLDER, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        final Path file1 = new DriveTouchFeature(session, fileid).touch(new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final Path file2 = new DriveTouchFeature(session, fileid).touch(new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        assertTrue(new DriveFindFeature(session, fileid).find(file1));
        assertTrue(new DriveFindFeature(session, fileid).find(file2));
        new DriveBatchDeleteFeature(session, fileid).delete(Arrays.asList(file1, file2), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse((new DriveFindFeature(session, fileid).find(file1, new DisabledListProgressListener())));
        assertFalse((new DriveFindFeature(session, fileid).find(file2, new DisabledListProgressListener())));
        assertTrue(new DriveFindFeature(session, fileid).find(folder, new DisabledListProgressListener()));
        new DriveBatchDeleteFeature(session, fileid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse((new DriveFindFeature(session, fileid).find(folder, new DisabledListProgressListener())));
    }