@Override
    public void setMetadata(final Path file, final TransferStatus status) throws BackgroundException {
        try {
            final String fileid = this.fileid.getFileId(file);
            final File body = new File();
            body.setProperties(status.getMetadata());
            final File properties = session.getClient().files().update(fileid, body).setFields("properties").
                    setSupportsAllDrives(new HostPreferences(session.getHost()).getBoolean("googledrive.teamdrive.enable")).execute();
            status.setResponse(new DriveAttributesFinderFeature(session, this.fileid).toAttributes(properties));
        }
        catch(IOException e) {
            throw new DriveExceptionMappingService(fileid).map("Failure to write attributes of {0}", e, file);
        }
    }
@Test
    public void setMetadata() throws Exception {
        final Path home = DriveHomeFinderService.MYDRIVE_FOLDER;
        final Path test = new Path(home, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        new DriveTouchFeature(session, fileid).touch(test, new TransferStatus());
        assertEquals(Collections.emptyMap(), new DriveMetadataFeature(session, fileid).getMetadata(test));
        new DriveMetadataFeature(session, fileid).setMetadata(test, Collections.singletonMap("test", "t"));
        assertEquals(Collections.singletonMap("test", "t"), new DriveMetadataFeature(session, fileid).getMetadata(test));
        new DriveDeleteFeature(session, fileid).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }