HistoryPresenter extends BasePresenter implements HistoryView.ActionDelegate { @Override public void onDiffWithWorkTreeClicked() { if (DiffWith.DIFF_WITH_WORK_TREE.equals(diffType)) { return; } diffType = DiffWith.DIFF_WITH_WORK_TREE; view.selectDiffWithIndexButton(false); view.selectDiffWithPrevVersionButton(false); view.selectDiffWithWorkingTreeButton(true); update(); } @Inject  HistoryPresenter(final HistoryView view,
                            EventBus eventBus,
                            GitResources resources,
                            GitServiceClient service,
                            final WorkspaceAgent workspaceAgent,
                            GitLocalizationConstant constant,
                            GitOutputPartPresenter console,
                            AppContext appContext,
                            NotificationManager notificationManager,
                            DtoUnmarshallerFactory dtoUnmarshallerFactory,
                            DateTimeFormatter dateTimeFormatter,
                            SelectionAgent selectionAgent); void showDialog(); @Override void onRefreshClicked(); @Override void onProjectChangesClicked(); @Override void onResourceChangesClicked(); @Override void onDiffWithIndexClicked(); @Override void onDiffWithWorkTreeClicked(); @Override void onDiffWithPrevCommitClicked(); @Override void onRevisionSelected(@NotNull Revision revision); @Override String getTitle(); @Override ImageResource getTitleImage(); @Override SVGResource getTitleSVGImage(); @Override String getTitleToolTip(); @Override void go(AcceptsOneWidget container); @Override int getSize();  }
@Test public void testOnDiffWithWorkTreeClicked() throws Exception { presenter.onDiffWithIndexClicked(); presenter.onRevisionSelected(selectedRevision); reset(view); reset(service); presenter.onDiffWithWorkTreeClicked(); verify(view).selectDiffWithWorkingTreeButton(eq(SELECTED_ITEM)); verify(view).selectDiffWithIndexButton(eq(UNSELECTED_ITEM)); verify(view).selectDiffWithPrevVersionButton(eq(UNSELECTED_ITEM)); verify(service) .diff((ProjectDescriptor)anyObject(), (List<String>)anyObject(), (DiffRequest.DiffType)anyObject(), anyBoolean(), anyInt(), anyString(), anyBoolean(), (AsyncRequestCallback<String>)anyObject()); verify(service, never()) .diff((ProjectDescriptor)anyObject(), (List<String>)anyObject(), (DiffRequest.DiffType)anyObject(), anyBoolean(), anyInt(), anyString(), anyString(), (AsyncRequestCallback<String>)anyObject()); verify(service).log(eq(rootProjectDescriptor), eq(TEXT_NOT_FORMATTED), (AsyncRequestCallback<LogResponse>)anyObject()); }
@Test public void testOnDiffWithWorkTreeTwiceClicked() throws Exception { presenter.onDiffWithWorkTreeClicked(); reset(view); reset(service); presenter.onDiffWithWorkTreeClicked(); verify(view, never()).selectDiffWithIndexButton(anyBoolean()); verify(view, never()).selectDiffWithPrevVersionButton(anyBoolean()); verify(view, never()).selectDiffWithWorkingTreeButton(anyBoolean()); verify(service, never()) .diff((ProjectDescriptor)anyObject(), (List<String>)anyObject(), (DiffRequest.DiffType)anyObject(), anyBoolean(), anyInt(), anyString(), anyBoolean(), (AsyncRequestCallback<String>)anyObject()); verify(service, never()) .diff((ProjectDescriptor)anyObject(), (List<String>)anyObject(), (DiffRequest.DiffType)anyObject(), anyBoolean(), anyInt(), anyString(), anyString(), (AsyncRequestCallback<String>)anyObject()); verify(service, never()).log(eq(projectDescriptor), eq(TEXT_NOT_FORMATTED), (AsyncRequestCallback<LogResponse>)anyObject()); }