diff --git a/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java index a8ed202c8d..4f7b02dfcc 100644 --- a/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java @@ -7,7 +7,9 @@ */ package com.owncloud.android; +import static com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.FOLDER_ALREADY_EXISTS; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import com.nextcloud.test.RandomStringGenerator; @@ -66,6 +68,23 @@ public void testCreateFolder() { assertTrue(result.isSuccess()); } + /** + * Test duplicate Folder + */ + @Test + public void testCreateDuplicateFolder() { + String remotePath = mFullPath2FolderBase + "duplicateFolder"; + mCreatedFolderPaths.add(remotePath); + RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); + assertTrue(result.isSuccess()); + + // Create folder again + mCreatedFolderPaths.add(remotePath); + result = new CreateFolderRemoteOperation(remotePath, true).execute(client); + assertFalse(result.isSuccess()); + assertEquals(FOLDER_ALREADY_EXISTS, result.getCode()); + } + @Test public void testFileID() { String remotePath = mFullPath2FolderBase + "/" + RandomStringGenerator.make(TAG_LENGTH);