File tree Expand file tree Collapse file tree
library/src/androidTest/java/com/owncloud/android Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 */
88package com .owncloud .android ;
99
10+ import static com .owncloud .android .lib .common .operations .RemoteOperationResult .ResultCode .FOLDER_ALREADY_EXISTS ;
1011import static org .junit .Assert .assertEquals ;
12+ import static org .junit .Assert .assertFalse ;
1113import static org .junit .Assert .assertTrue ;
1214
1315import com .nextcloud .test .RandomStringGenerator ;
@@ -66,6 +68,23 @@ public void testCreateFolder() {
6668 assertTrue (result .isSuccess ());
6769 }
6870
71+ /**
72+ * Test duplicate Folder
73+ */
74+ @ Test
75+ public void testCreateDuplicateFolder () {
76+ String remotePath = mFullPath2FolderBase + "duplicateFolder" ;
77+ mCreatedFolderPaths .add (remotePath );
78+ RemoteOperationResult <String > result = new CreateFolderRemoteOperation (remotePath , true ).execute (client );
79+ assertTrue (result .isSuccess ());
80+
81+ // Create folder again
82+ mCreatedFolderPaths .add (remotePath );
83+ result = new CreateFolderRemoteOperation (remotePath , true ).execute (client );
84+ assertFalse (result .isSuccess ());
85+ assertEquals (FOLDER_ALREADY_EXISTS , result .getCode ());
86+ }
87+
6988 @ Test
7089 public void testFileID () {
7190 String remotePath = mFullPath2FolderBase + "/" + RandomStringGenerator .make (TAG_LENGTH );
You can’t perform that action at this time.
0 commit comments