@Test public void setupWhenPopulatedDiffListTest() throws NoSuchFieldException { new FieldSetter(presenter, ChangedFilesScreenPresenter.class.getDeclaredField("workspaceProject")) .set(workspaceProject); List<ChangeRequestDiff> diffs = Collections.nCopies(5, mock(ChangeRequestDiff.class)); doReturn(diffs).when(changeRequestService).getDiff(anyString(), anyString(), anyLong()); presenter.setup(changeRequest, b -> { }, i -> { }); verify(view).setFilesSummary(anyString()); verify(view, times(5)).addDiffItem(any(), any()); }
public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback, final IntConsumer setChangedFilesCountCallback) { changeRequestService.call((final List<ChangeRequestDiff> diffList) -> { setChangedFilesCountCallback.accept(diffList.size()); if (!diffList.isEmpty()) { final boolean warnConflict = changeRequest.getStatus() == ChangeRequestStatus.OPEN; this.setupDiffList(diffList, warnConflict); this.view.showDiffList(true); } else { this.destroyDiffItems(); this.view.clearDiffList(); } this.setupFilesSummary(diffList); finishLoadingCallback.accept(true); }).getDiff(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), changeRequest.getId()); }
ChangedFilesScreenPresenter { public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback, final IntConsumer setChangedFilesCountCallback) { changeRequestService.call((final List<ChangeRequestDiff> diffList) -> { setChangedFilesCountCallback.accept(diffList.size()); if (!diffList.isEmpty()) { final boolean warnConflict = changeRequest.getStatus() == ChangeRequestStatus.OPEN; this.setupDiffList(diffList, warnConflict); this.view.showDiffList(true); } else { this.destroyDiffItems(); this.view.clearDiffList(); } this.setupFilesSummary(diffList); finishLoadingCallback.accept(true); }).getDiff(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), changeRequest.getId()); } }
ChangedFilesScreenPresenter { public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback, final IntConsumer setChangedFilesCountCallback) { changeRequestService.call((final List<ChangeRequestDiff> diffList) -> { setChangedFilesCountCallback.accept(diffList.size()); if (!diffList.isEmpty()) { final boolean warnConflict = changeRequest.getStatus() == ChangeRequestStatus.OPEN; this.setupDiffList(diffList, warnConflict); this.view.showDiffList(true); } else { this.destroyDiffItems(); this.view.clearDiffList(); } this.setupFilesSummary(diffList); finishLoadingCallback.accept(true); }).getDiff(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), changeRequest.getId()); } @Inject  ChangedFilesScreenPresenter(final View view,
                                       final ManagedInstance<DiffItemPresenter> diffItemPresenterInstances,
                                       final ChangeRequestUtils changeRequestUtils,
                                       final Caller<ChangeRequestService> changeRequestService,
                                       final LibraryPlaces libraryPlaces); }
ChangedFilesScreenPresenter { public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback, final IntConsumer setChangedFilesCountCallback) { changeRequestService.call((final List<ChangeRequestDiff> diffList) -> { setChangedFilesCountCallback.accept(diffList.size()); if (!diffList.isEmpty()) { final boolean warnConflict = changeRequest.getStatus() == ChangeRequestStatus.OPEN; this.setupDiffList(diffList, warnConflict); this.view.showDiffList(true); } else { this.destroyDiffItems(); this.view.clearDiffList(); } this.setupFilesSummary(diffList); finishLoadingCallback.accept(true); }).getDiff(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), changeRequest.getId()); } @Inject  ChangedFilesScreenPresenter(final View view,
                                       final ManagedInstance<DiffItemPresenter> diffItemPresenterInstances,
                                       final ChangeRequestUtils changeRequestUtils,
                                       final Caller<ChangeRequestService> changeRequestService,
                                       final LibraryPlaces libraryPlaces); @PostConstruct void postConstruct(); View getView(); void reset(); void setup(final ChangeRequest changeRequest,
                      final Consumer<Boolean> finishLoadingCallback,
                      final IntConsumer setChangedFilesCountCallback); }
ChangedFilesScreenPresenter { public void setup(final ChangeRequest changeRequest, final Consumer<Boolean> finishLoadingCallback, final IntConsumer setChangedFilesCountCallback) { changeRequestService.call((final List<ChangeRequestDiff> diffList) -> { setChangedFilesCountCallback.accept(diffList.size()); if (!diffList.isEmpty()) { final boolean warnConflict = changeRequest.getStatus() == ChangeRequestStatus.OPEN; this.setupDiffList(diffList, warnConflict); this.view.showDiffList(true); } else { this.destroyDiffItems(); this.view.clearDiffList(); } this.setupFilesSummary(diffList); finishLoadingCallback.accept(true); }).getDiff(workspaceProject.getSpace().getName(), workspaceProject.getRepository().getAlias(), changeRequest.getId()); } @Inject  ChangedFilesScreenPresenter(final View view,
                                       final ManagedInstance<DiffItemPresenter> diffItemPresenterInstances,
                                       final ChangeRequestUtils changeRequestUtils,
                                       final Caller<ChangeRequestService> changeRequestService,
                                       final LibraryPlaces libraryPlaces); @PostConstruct void postConstruct(); View getView(); void reset(); void setup(final ChangeRequest changeRequest,
                      final Consumer<Boolean> finishLoadingCallback,
                      final IntConsumer setChangedFilesCountCallback);  }