Skip to content

Commit 556994d

Browse files
committed
Add test.
1 parent 28bd513 commit 556994d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ssh/src/test/java/ch/cyberduck/core/sftp/SFTPMoveFeatureTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch
1818
*/
1919

20+
import ch.cyberduck.core.AlphanumericRandomStringService;
2021
import ch.cyberduck.core.DisabledConnectionCallback;
2122
import ch.cyberduck.core.DisabledLoginCallback;
2223
import ch.cyberduck.core.Path;
@@ -63,6 +64,20 @@ public void testMoveOverride() throws Exception {
6364
new SFTPDeleteFeature(session).delete(Collections.<Path>singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback());
6465
}
6566

67+
@Test
68+
public void testMoveOverrideDirectory() throws Exception {
69+
final Path workdir = new SFTPHomeDirectoryService(session).find();
70+
final Path test = new Path(workdir, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
71+
new SFTPDirectoryFeature(session).mkdir(test, new TransferStatus());
72+
final Path target = new Path(workdir, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
73+
new SFTPDirectoryFeature(session).mkdir(target, new TransferStatus());
74+
new SFTPTouchFeature(session).touch(new Path(target, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
75+
new SFTPMoveFeature(session).move(test, target, new TransferStatus().exists(true), new Delete.DisabledCallback(), new DisabledConnectionCallback());
76+
assertFalse(new SFTPFindFeature(session).find(test));
77+
assertTrue(new SFTPFindFeature(session).find(target));
78+
new SFTPDeleteFeature(session).delete(Collections.singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback());
79+
}
80+
6681
@Test(expected = NotfoundException.class)
6782
public void testMoveNotFound() throws Exception {
6883
final Path workdir = new SFTPHomeDirectoryService(session).find();

0 commit comments

Comments
 (0)