Search in sources :

Example 1 with IInAppNotificationStore

use of com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore in project wire-android by wireapp.

the class FileUploadTest method assertFileTooBigWarningShowed.

@Test
@SuppressLint("NewApi")
public void assertFileTooBigWarningShowed() throws InterruptedException {
    final ErrorsList.ErrorDescription mockErrorDescription = mock(ErrorsList.ErrorDescription.class);
    when(mockErrorDescription.getType()).thenReturn(ErrorType.CANNOT_SEND_ASSET_TOO_LARGE);
    IInAppNotificationStore mockInAppNotificationStore = activity.getStoreFactory().getInAppNotificationStore();
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocation) {
            Object[] args = invocation.getArguments();
            InAppNotificationStoreObserver u = (InAppNotificationStoreObserver) args[0];
            u.onSyncError(mockErrorDescription);
            return null;
        }
    }).when(mockInAppNotificationStore).addInAppNotificationObserver(any(InAppNotificationStoreObserver.class));
    // attach fragment
    attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
    onView(withText(activity.getString(R.string.asset_upload_error__file_too_large__title))).check(isVisible());
}
Also used : ErrorsList(com.waz.api.ErrorsList) InvocationOnMock(org.mockito.invocation.InvocationOnMock) InAppNotificationStoreObserver(com.waz.zclient.core.stores.inappnotification.InAppNotificationStoreObserver) IInAppNotificationStore(com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test) SuppressLint(android.annotation.SuppressLint)

Example 2 with IInAppNotificationStore

use of com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore in project wire-android by wireapp.

the class FileUploadTest method assertFileNotFoundWarningShowed.

@Test
@SuppressLint("NewApi")
public void assertFileNotFoundWarningShowed() throws InterruptedException {
    final ErrorsList.ErrorDescription mockErrorDescription = mock(ErrorsList.ErrorDescription.class);
    when(mockErrorDescription.getType()).thenReturn(ErrorType.CANNOT_SEND_ASSET_FILE_NOT_FOUND);
    IInAppNotificationStore mockInAppNotificationStore = activity.getStoreFactory().getInAppNotificationStore();
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocation) {
            Object[] args = invocation.getArguments();
            InAppNotificationStoreObserver u = (InAppNotificationStoreObserver) args[0];
            u.onSyncError(mockErrorDescription);
            return null;
        }
    }).when(mockInAppNotificationStore).addInAppNotificationObserver(any(InAppNotificationStoreObserver.class));
    // attach fragment
    attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
    onView(withText(activity.getString(R.string.asset_upload_error__not_found__title))).check(isVisible());
}
Also used : ErrorsList(com.waz.api.ErrorsList) InvocationOnMock(org.mockito.invocation.InvocationOnMock) InAppNotificationStoreObserver(com.waz.zclient.core.stores.inappnotification.InAppNotificationStoreObserver) IInAppNotificationStore(com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test) SuppressLint(android.annotation.SuppressLint)

Example 3 with IInAppNotificationStore

use of com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore in project wire-android by wireapp.

the class AudioRecordingTest method assertRecordingFailureWarningShowed.

@Test
@SuppressLint("NewApi")
public void assertRecordingFailureWarningShowed() throws InterruptedException {
    final ErrorsList.ErrorDescription mockErrorDescription = mock(ErrorsList.ErrorDescription.class);
    when(mockErrorDescription.getType()).thenReturn(ErrorType.RECORDING_FAILURE);
    IInAppNotificationStore mockInAppNotificationStore = activity.getStoreFactory().getInAppNotificationStore();
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocation) {
            Object[] args = invocation.getArguments();
            InAppNotificationStoreObserver u = (InAppNotificationStoreObserver) args[0];
            u.onSyncError(mockErrorDescription);
            return null;
        }
    }).when(mockInAppNotificationStore).addInAppNotificationObserver(any(InAppNotificationStoreObserver.class));
    // attach fragment
    attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
    onView(withText(activity.getString(R.string.audio_message__recording__failure__title))).check(isVisible());
}
Also used : ErrorsList(com.waz.api.ErrorsList) InvocationOnMock(org.mockito.invocation.InvocationOnMock) InAppNotificationStoreObserver(com.waz.zclient.core.stores.inappnotification.InAppNotificationStoreObserver) IInAppNotificationStore(com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore) Test(org.junit.Test) FragmentTest(com.waz.zclient.testutils.FragmentTest) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)3 ErrorsList (com.waz.api.ErrorsList)3 IInAppNotificationStore (com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore)3 InAppNotificationStoreObserver (com.waz.zclient.core.stores.inappnotification.InAppNotificationStoreObserver)3 FragmentTest (com.waz.zclient.testutils.FragmentTest)3 Test (org.junit.Test)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3