ChangePasswordActivity extends RapidFtrActivity { protected boolean validatesPresenceOfMandatoryFields() { return validateTextFieldNotEmpty(R.id.current_password, R.string.mandatory) & validateTextFieldNotEmpty(R.id.new_password, R.string.mandatory) & validateTextFieldNotEmpty(R.id.new_password_confirm, R.string.mandatory); }  void changePassword(View view);  }
@Test @Ignore public void shouldCheckIfMandatoryFieldsAreFilled() { newPassword = mock(EditText.class); newPasswordConfirm = mock(EditText.class); currentPassword = mock(EditText.class); doReturn(currentPassword).when(changePasswordActivity).findViewById(R.id.current_password); doReturn(newPassword).when(changePasswordActivity).findViewById(R.id.new_password); doReturn(newPasswordConfirm).when(changePasswordActivity).findViewById(R.id.new_password_confirm); changePasswordActivity.validatesPresenceOfMandatoryFields(); verify(currentPassword).setError(changePasswordActivity.getString(R.string.mandatory)); verify(newPassword).setError(changePasswordActivity.getString(R.string.mandatory)); }