@Test public void createProjectWithDuplicatedNameTest() { doReturn("new-branch").when(view).getName(); doReturn("master").when(view).getBranchFrom(); doThrow(new FileAlreadyExistsException()).when(libraryService).addBranch(any(), any(), any()); presenter.add(); verify(view).setAddButtonEnabled(false); verify(view).showBusyIndicator(anyString()); verify(view).hideBusyIndicator(); verify(view, never()).hide(); verify(view).showError(anyString()); verify(view).setAddButtonEnabled(true); }
public void add() { final String name = view.getName(); final String branchFrom = view.getBranchFrom(); beginBranchCreation(); validateFields(name, () -> libraryService.call(v -> { endBranchCreation(); notifySuccess(); view.hide(); }, getErrorCallback()).addBranch(name, branchFrom, project)); }
AddBranchPopUpPresenter { public void add() { final String name = view.getName(); final String branchFrom = view.getBranchFrom(); beginBranchCreation(); validateFields(name, () -> libraryService.call(v -> { endBranchCreation(); notifySuccess(); view.hide(); }, getErrorCallback()).addBranch(name, branchFrom, project)); } }
AddBranchPopUpPresenter { public void add() { final String name = view.getName(); final String branchFrom = view.getBranchFrom(); beginBranchCreation(); validateFields(name, () -> libraryService.call(v -> { endBranchCreation(); notifySuccess(); view.hide(); }, getErrorCallback()).addBranch(name, branchFrom, project)); } @Inject  AddBranchPopUpPresenter(final Caller<LibraryService> libraryService,
                                   final BusyIndicatorView busyIndicatorView,
                                   final Event<NotificationEvent> notificationEvent,
                                   final LibraryPlaces libraryPlaces,
                                   final View view,
                                   final Caller<ValidationService> validationService); }
AddBranchPopUpPresenter { public void add() { final String name = view.getName(); final String branchFrom = view.getBranchFrom(); beginBranchCreation(); validateFields(name, () -> libraryService.call(v -> { endBranchCreation(); notifySuccess(); view.hide(); }, getErrorCallback()).addBranch(name, branchFrom, project)); } @Inject  AddBranchPopUpPresenter(final Caller<LibraryService> libraryService,
                                   final BusyIndicatorView busyIndicatorView,
                                   final Event<NotificationEvent> notificationEvent,
                                   final LibraryPlaces libraryPlaces,
                                   final View view,
                                   final Caller<ValidationService> validationService); @PostConstruct void setup(); void show(); void add(); void cancel(); }
AddBranchPopUpPresenter { public void add() { final String name = view.getName(); final String branchFrom = view.getBranchFrom(); beginBranchCreation(); validateFields(name, () -> libraryService.call(v -> { endBranchCreation(); notifySuccess(); view.hide(); }, getErrorCallback()).addBranch(name, branchFrom, project)); } @Inject  AddBranchPopUpPresenter(final Caller<LibraryService> libraryService,
                                   final BusyIndicatorView busyIndicatorView,
                                   final Event<NotificationEvent> notificationEvent,
                                   final LibraryPlaces libraryPlaces,
                                   final View view,
                                   final Caller<ValidationService> validationService); @PostConstruct void setup(); void show(); void add(); void cancel();  }