private void setManagedStatus(final Repository repository, final String branch, final boolean managed) { view.showBusyIndicator(Constants.INSTANCE.CreatingRepositoryStructure()); repositoryStructureService.call(new RemoteCallback<Repository>() { @Override public void callback(Repository repository) { presenter.loadModel(repository, branch); } }, new HasBusyIndicatorDefaultErrorCallback(view)).updateManagedStatus(repository, managed); } }
@Test public void testUpdateNonManaged() throws Exception { updater.updateNonManaged(repository, "master"); verify(view).showBusyIndicator("CreatingRepositoryStructure"); verify(service).updateManagedStatus(repository, false); verify(presenter).loadModel(updatedRepository, "master"); }
@Test public void testInitSingleProjectNullProject() throws Exception { updater.initSingleProject(repository, "master"); verify(wizard).initialise(any(POM.class)); verify(wizard).start(callbackArgumentCaptor.capture(), eq(false)); callbackArgumentCaptor.getValue().callback(null); verify(history).setLastAddedModule(null); verify(service, never()).updateManagedStatus(any(Repository.class), anyBoolean()); verify(presenter, never()).loadModel(any(Repository.class), anyString()); } }
@Test public void testInitSingleProject() throws Exception { updater.initSingleProject(repository, "master"); verify(wizard).initialise(any(POM.class)); verify(wizard).start(callbackArgumentCaptor.capture(), eq(false)); final Project project = new Project(); callbackArgumentCaptor.getValue().callback(project); verify(history).setLastAddedModule(project); verify(service).updateManagedStatus(repository, true); verify(presenter).loadModel(updatedRepository, "master"); }
@Before public void setUp() throws Exception { when(service.updateManagedStatus(eq(repository), anyBoolean())).thenReturn(updatedRepository); updater = new RepositoryManagedStatusUpdater(new CallerMock<>(service), wizard); updater.bind(view, history, presenter); }