@Override
    public String lock(final Path file) throws BackgroundException {
        if(!containerService.getContainer(file).getType().contains(Path.Type.shared)) {
            log.warn(String.format("Skip attempting to lock file %s not in shared folder", file));
            throw new UnsupportedException();
        }
        try {
            for(LockFileResultEntry result : new DbxUserFilesRequests(session.getClient(file)).lockFileBatch(Collections.singletonList(
                new LockFileArg(containerService.getKey(file)))).getEntries()) {
                if(result.isFailure()) {
                    throw this.failure(result);
                }
                if(result.isSuccess()) {
                    if(log.isDebugEnabled()) {
                        log.debug(String.format("Locked file %s with result %s", file, result.getSuccessValue()));
                    }
                    return String.valueOf(true);
                }
            }
            return null;
        }
        catch(DbxException e) {
            throw new DropboxExceptionMappingService().map("Failure to write attributes of {0}", e, file);
        }
    }
@Test
    public void testLockNotShared() throws Exception {
        final DropboxTouchFeature touch = new DropboxTouchFeature(session);
        final Path file = touch.touch(new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final DropboxLockFeature f = new DropboxLockFeature(session);
        try {
            final String lock = f.lock(file);
            fail();
        }
        catch(UnsupportedException e) {
            //
        }
        new DropboxDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }