@Test public void testChangeBranch() throws Exception { when(activeContextItems.getActiveBranch()).thenReturn("master"); presenter.onBranchSelected("dev"); verify(explorer).clear(); verify(activeContextManager).initActiveContext(organizationalUnit, repository, "dev"); }
@Test public void testStillInSameBranch() throws Exception { when(activeContextItems.getActiveBranch()).thenReturn("master"); presenter.onBranchSelected("master"); verify(explorer, never()).clear(); verify(activeContextManager, never()) .initActiveContext(any(OrganizationalUnit.class), any(Repository.class), anyString()); }
@Before public void setup() { when(activeContextItems.getActiveOrganizationalUnit()).thenReturn(organizationalUnit); when(activeContextItems.getActiveRepository()).thenReturn(repository); when(view.getExplorer()).thenReturn(explorer); }