@Test public void testNameChange() { when(view.getName()).thenReturn(NAME); // emulates the presenter method executed from the UI. mainPanel.onNameChange(); verify(view, times(1)).getName(); // the handler should have been invoked and collected the expected value. assertEquals(NAME, name); }
@Test public void testGetName() { when(view.getName()).thenReturn(NAME); assertEquals(NAME, mainPanel.getName()); }