use of com.google.android.apps.common.testing.ui.espresso.PerformException in project double-espresso by JakeWharton.
the class TypeTextActionTest method testTypeTextActionPerformInjectEventSecurityException.
public void testTypeTextActionPerformInjectEventSecurityException() throws InjectEventSecurityException {
String stringToBeTyped = "Hello!";
typeTextAction = new TypeTextAction(stringToBeTyped);
when(mockUiController.injectMotionEvent(isA(MotionEvent.class))).thenReturn(true);
when(mockUiController.injectString(stringToBeTyped)).thenThrow(new InjectEventSecurityException(""));
try {
typeTextAction.perform(mockUiController, mockView);
fail("Should have thrown PerformException");
} catch (PerformException e) {
if (!(e.getCause() instanceof InjectEventSecurityException)) {
fail("Exception cause should be of type InjectEventSecurityException");
}
}
}
Aggregations