Search in sources :

Example 1 with MockUser

use of com.nextcloud.client.account.MockUser in project android by nextcloud.

the class ErrorMessageAdapterIT method getErrorCauseMessageForForbiddenRemoval.

@Test
public void getErrorCauseMessageForForbiddenRemoval() {
    Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
    User user = new MockUser("name", ACCOUNT_TYPE);
    Context context = MainApp.getAppContext();
    String errorMessage = ErrorMessageAdapter.getErrorCauseMessage(new RemoteOperationResult(RemoteOperationResult.ResultCode.FORBIDDEN), new RemoveFileOperation(new OCFile(PATH_TO_DELETE), false, user.toPlatformAccount(), false, context, new FileDataStorageManager(user, context.getContentResolver())), resources);
    assertEquals(EXPECTED_ERROR_MESSAGE, errorMessage);
}
Also used : Context(android.content.Context) OCFile(com.owncloud.android.datamodel.OCFile) User(com.nextcloud.client.account.User) MockUser(com.nextcloud.client.account.MockUser) RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) FileDataStorageManager(com.owncloud.android.datamodel.FileDataStorageManager) Resources(android.content.res.Resources) RemoveFileOperation(com.owncloud.android.operations.RemoveFileOperation) MockUser(com.nextcloud.client.account.MockUser) Test(org.junit.Test)

Aggregations

Context (android.content.Context)1 Resources (android.content.res.Resources)1 MockUser (com.nextcloud.client.account.MockUser)1 User (com.nextcloud.client.account.User)1 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)1 OCFile (com.owncloud.android.datamodel.OCFile)1 RemoteOperationResult (com.owncloud.android.lib.common.operations.RemoteOperationResult)1 RemoveFileOperation (com.owncloud.android.operations.RemoveFileOperation)1 Test (org.junit.Test)1