@Test public void testPasswordChange() { when(view.getPassword()).thenReturn(PASSWORD); // emulates the presenter method executed from the UI. mainPanel.onPasswordChange(); verify(view, times(1)).getPassword(); // the handler should have been invoked and collected the expected value. assertEquals(PASSWORD, password); }
@Test public void testGetPassword() { when(view.getPassword()).thenReturn(PASSWORD); assertEquals(PASSWORD, mainPanel.getPassword()); }