@Override
    public void symlink(final Path file, final String target) throws BackgroundException {
        try {
            Files.createSymbolicLink(session.toPath(file), session.toPath(target));
        }
        catch(IOException e) {
            throw new LocalExceptionMappingService().map("Cannot create {0}", e, file);
        }
    }
@Test
    public void testSymlink() throws Exception {
        final LocalSession session = new LocalSession(new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname()));
        assumeTrue(session.isPosixFilesystem());
        session.open(new DisabledProxyFinder(), new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
        session.login(new DisabledLoginCallback(), new DisabledCancelCallback());
        final Path workdir = new LocalHomeFinderFeature().find();
        final Path target = new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        new LocalTouchFeature(session).touch(target, new TransferStatus());
        final Path link = new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file, AbstractPath.Type.symboliclink));
        new LocalSymlinkFeature(session).symlink(link, target.getName());
        assertTrue(new LocalFindFeature(session).find(link));
        assertEquals(EnumSet.of(Path.Type.file, AbstractPath.Type.symboliclink),
                new LocalListService(session).list(workdir, new DisabledListProgressListener()).get(link).getType());
        new LocalDeleteFeature(session).delete(Collections.singletonList(link), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new LocalFindFeature(session).find(link));
        assertTrue(new LocalFindFeature(session).find(target));
        new LocalDeleteFeature(session).delete(Collections.singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback());
        session.close();
    }