LoginActivity extends RapidFtrActivity { protected boolean isValid() { return validateTextFieldNotEmpty(userNameView, R.string.username_required) & validateTextFieldNotEmpty(passwordView, R.string.password_required); }  @AfterViews void afterCreate(); @Click(R.id.change_url) void onChangeUrlClick(); @Click(R.id.login_button) void onLoginClick(); @Click(R.id.new_user_signup_link) void onSignupClick();  }
@Test public void shouldInvalidateUserNameAndPassword() { doCallRealMethod().when(loginActivity).isValid(); assertFalse(loginActivity.isValid()); verify(loginActivity).validateTextFieldNotEmpty(userNameView, R.string.username_required); verify(loginActivity).validateTextFieldNotEmpty(passwordView, R.string.password_required); }
@Test @Ignore public void shouldValidateUserNameAndPassword() { doCallRealMethod().when(loginActivity).isValid(); given(loginActivity.userNameView.getText().toString()).willReturn("test"); given(loginActivity.passwordView.getText().toString()).willReturn("test"); assertTrue(loginActivity.isValid()); }