@Test public void testUserChange() { when(view.getUser()).thenReturn(USER); // emulates the presenter method executed from the UI. mainPanel.onUserChange(); verify(view, times(1)).getUser(); // the handler should have been invoked and collected the expected value. assertEquals(USER, user); }
@Test public void testGetUser() { when(view.getUser()).thenReturn(USER); assertEquals(USER, mainPanel.getUser()); }