@Test public void testLogin() throws IllegalActionException, ServiceException { // User clicks login presenter.onLoginClick(); // Login dialog appears verify(loginDialog).showCentered(); // User fills login form and he submits it presenter.onLogin(testUserProvider.getUser().name(), testUserProvider.getPassword()); // User is logged verify(userBarView).setUsername(testUserProvider.getUser().name()); }
@Before public void setup() { MockitoAnnotations.initMocks(this); ModuleAnnotations.init(this); testUserProvider.createTestUser(); }
@Test public void testSignupFail() throws IllegalActionException, ServiceException { String username = testUserProvider.getUser().name(); // User clicks sign-up presenter.onRegister(); // Register dialog appears verify(registerDialog).showCentered(); // User fills register form and he submits it presenter.onRegister(username, "newPassword", "*****@*****.**"); // Alert dialog is shown verify(alertDialog).center(Mockito.any(Error.class)); }