@Override
    public Path move(final Path file, final Path renamed, final TransferStatus status,
                     final Delete.Callback deleteCallback, final ConnectionCallback connectionCallback) throws BackgroundException {
        try {
            session.getClient().move(file.getAbsolute(), renamed.getAbsolute());
            // Copy original file attributes
            return renamed.withAttributes(file.attributes());
        }
        catch(MantaException e) {
            throw new MantaExceptionMappingService().map("Cannot rename {0}", e, file);
        }
        catch(MantaClientHttpResponseException e) {
            throw new MantaHttpExceptionMappingService().map("Cannot rename {0}", e, file);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Cannot rename {0}", e, file);
        }
    }
@Test
    public void testMove() throws BackgroundException {
        final Directory directory = new MantaDirectoryFeature(session);
        final Touch touch = new MantaTouchFeature(session);
        final Move move = new MantaMoveFeature(session);
        final Delete delete = new MantaDeleteFeature(session);
        final AttributesFinder attributesFinder = new MantaAttributesFinderFeature(session);
        final Path drive = new MantaDirectoryFeature(session).mkdir(randomDirectory(), new TransferStatus());
        Path targetDirectory = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
        directory.mkdir(targetDirectory, null);
        assertNotNull(attributesFinder.find(targetDirectory));
        Path touchedFile = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        touch.touch(touchedFile, new TransferStatus().withMime("x-application/cyberduck"));
        assertNotNull(attributesFinder.find(touchedFile));
        Path rename = new Path(targetDirectory, touchedFile.getName(), EnumSet.of(Path.Type.file));
        assertTrue(move.isSupported(touchedFile, rename));
        assertEquals(rename, move.move(touchedFile, rename, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback()));
        assertNotNull(attributesFinder.find(rename));
        assertFalse(new MantaFindFeature(session).find(touchedFile));
        assertTrue(new MantaFindFeature(session).find(rename));
        delete.delete(Collections.singletonList(targetDirectory), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }