diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java index 79a0e9c11d..45f892cbc9 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java @@ -27,21 +27,21 @@ package com.nextcloud.android.lib.resources.directediting; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import com.owncloud.android.AbstractIT; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class DirectEditingCreateFileRemoteOperationIT extends AbstractIT { @Test public void createEmptyFile() { RemoteOperationResult result = new DirectEditingCreateFileRemoteOperation("/test.md", "text", "textdocument") - .execute(client); + .execute(nextcloudClient); assertTrue(result.isSuccess()); String url = result.getResultData(); @@ -55,7 +55,7 @@ public void createFileFromTemplate() { "text", "textdocument", "1") - .execute(client); + .execute(nextcloudClient); assertTrue(result.isSuccess()); String url = result.getResultData(); @@ -69,7 +69,7 @@ public void createFileWithSpecialCharacterFromTemplate() { "text", "textdocument", "1") - .execute(client); + .execute(nextcloudClient); assertTrue(result.isSuccess()); String url = result.getResultData(); diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java index 5bc21ab979..2b83b1fa2a 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java @@ -27,27 +27,29 @@ package com.nextcloud.android.lib.resources.directediting; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import com.owncloud.android.AbstractIT; import com.owncloud.android.lib.common.TemplateList; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import org.junit.Test; +import java.util.Objects; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class DirectEditingObtainListOfTemplatesRemoteOperationIT extends AbstractIT { @Test public void testGetAll() { - RemoteOperationResult result = new DirectEditingObtainListOfTemplatesRemoteOperation("text", + RemoteOperationResult result = new DirectEditingObtainListOfTemplatesRemoteOperation("text", "textdocument") - .execute(client); + .execute(nextcloudClient); assertTrue(result.isSuccess()); TemplateList templateList = (TemplateList) result.getResultData(); - assertEquals("Empty file", templateList.getTemplates().get("empty").getTitle()); - assertEquals("md", templateList.getTemplates().get("empty").getExtension()); + assertEquals("Empty file", Objects.requireNonNull(templateList.getTemplates().get("empty")).getTitle()); + assertEquals("md", Objects.requireNonNull(templateList.getTemplates().get("empty")).getExtension()); } } diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java index 4657320bfb..641681c0c8 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java @@ -27,9 +27,6 @@ package com.nextcloud.android.lib.resources.directediting; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import com.owncloud.android.AbstractIT; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation; @@ -41,6 +38,9 @@ import java.io.IOException; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class DirectEditingOpenFileRemoteOperationIT extends AbstractIT { @Test public void openFile() throws IOException { @@ -57,10 +57,11 @@ public void openFile() throws IOException { TestCase.assertTrue(new ReadFileRemoteOperation(remotePath).execute(client).isSuccess()); // open file - RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text").execute(client); + RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text") + .execute(nextcloudClient); assertTrue(result.isSuccess()); - String url = (String) result.getSingleData(); + String url = result.getResultData(); assertFalse(url.isEmpty()); } @@ -80,10 +81,11 @@ public void openFileWithSpecialChars() throws IOException { TestCase.assertTrue(new ReadFileRemoteOperation(remotePath).execute(client).isSuccess()); // open file - RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text").execute(client); + RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text") + .execute(nextcloudClient); assertTrue(result.isSuccess()); - String url = (String) result.getSingleData(); + String url = result.getResultData(); assertFalse(url.isEmpty()); } @@ -103,10 +105,11 @@ public void openFileWithSpecialChars2() throws IOException { TestCase.assertTrue(new ReadFileRemoteOperation(remotePath).execute(client).isSuccess()); // open file - RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text").execute(client); + RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text") + .execute(nextcloudClient); assertTrue(result.isSuccess()); - String url = (String) result.getSingleData(); + String url = result.getResultData(); assertFalse(url.isEmpty()); } @@ -118,7 +121,8 @@ public void openNonExistingFile() { TestCase.assertFalse(new ReadFileRemoteOperation(remotePath).execute(client).isSuccess()); // open file - RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text").execute(client); + RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(remotePath, "text") + .execute(nextcloudClient); assertFalse(result.isSuccess()); } }