Skip to content

Instantly share code, notes, and snippets.

@ecgreb
Created April 11, 2017 06:47
Show Gist options
  • Save ecgreb/3431b90653b8ab2b1f02b461e43040f1 to your computer and use it in GitHub Desktop.
Save ecgreb/3431b90653b8ab2b1f02b461e43040f1 to your computer and use it in GitHub Desktop.
public class LoginPresenterTest {
private TestLoginController loginController = new TestLoginController();
private LoginPresenter loginPresenter = new LoginPresenter(new TestAccountValidator());
@Before public void setUp() throws Exception {
loginPresenter.register(loginController);
}
@Test public void onLoginButtonClick_shouldShowSuccessOnValidInput() throws Exception {
loginPresenter.onLoginButtonClick("valid_username", "valid_password");
assertThat(loginController.success).isTrue();
}
@Test public void onLoginButtonClick_shouldShowErrorOnInvalidInput() throws Exception {
loginPresenter.onLoginButtonClick("invalid_username", "invalid_password");
assertThat(loginController.error).isTrue();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment