Search in sources :

Example 46 with RemoteOperationResult

use of com.owncloud.android.lib.common.operations.RemoteOperationResult in project android by owncloud.

the class ErrorMessageAdapterUnitTest method getErrorCauseMessageForForbiddenRemoval.

@Test
public void getErrorCauseMessageForForbiddenRemoval() {
    // Given a mocked set of resources passed to the object under test...
    when(mMockResources.getString(R.string.forbidden_permissions)).thenReturn(MOCK_FORBIDDEN_PERMISSIONS);
    when(mMockResources.getString(R.string.forbidden_permissions_delete)).thenReturn(MOCK_TO_DELETE);
    // ... when method under test is called ...
    String errorMessage = ErrorMessageAdapter.getErrorCauseMessage(new RemoteOperationResult(RemoteOperationResult.ResultCode.FORBIDDEN), new RemoveFileOperation(PATH_TO_DELETE, false), mMockResources);
    // ... then the result should be the expected one.
    assertThat(errorMessage, is(EXPECTED_ERROR_MESSAGE));
}
Also used : RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) RemoveFileOperation(com.owncloud.android.operations.RemoveFileOperation) Test(org.junit.Test)

Aggregations

RemoteOperationResult (com.owncloud.android.lib.common.operations.RemoteOperationResult)46 OCFile (com.owncloud.android.datamodel.OCFile)11 ArrayList (java.util.ArrayList)9 RemoteOperation (com.owncloud.android.lib.common.operations.RemoteOperation)7 OCShare (com.owncloud.android.lib.resources.shares.OCShare)7 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)6 ExistenceCheckRemoteOperation (com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation)6 OwnCloudAccount (com.owncloud.android.lib.common.OwnCloudAccount)5 OperationCancelledException (com.owncloud.android.lib.common.operations.OperationCancelledException)5 File (java.io.File)5 IOException (java.io.IOException)5 Account (android.accounts.Account)4 Uri (android.net.Uri)4 Intent (android.content.Intent)3 RemoteFile (com.owncloud.android.lib.resources.files.RemoteFile)3 GetRemoteSharesForFileOperation (com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation)3 UserInfo (com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation.UserInfo)3 AccountManager (android.accounts.AccountManager)2 Pair (android.util.Pair)2 OwnCloudClient (com.owncloud.android.lib.common.OwnCloudClient)2