HistoryPresenter extends BasePresenter implements HistoryView.ActionDelegate { @Override public void onResourceChangesClicked() { if (!showChangesInProject) { return; } showChangesInProject = false; view.selectProjectChangesButton(false); view.selectResourceChangesButton(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 testOnResourceChangesClicked() throws Exception { Selection sel = mock(Selection.class); ItemReference item = mock(ItemReference.class); ActivePartChangedEvent event = mock(ActivePartChangedEvent.class); when(event.getActivePart()).thenReturn(activePart); when(activePart.getSelection()).thenReturn(sel); when(sel.getFirstElement()).thenReturn(item); when(selection.getFirstElement()).thenReturn(item); when(item.getPath()).thenReturn("testProject/src"); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); List<String> filePatterns = (List<String>)arguments[1]; if (filePatterns.size() != 0) { int expected = 1; int actual = filePatterns.size(); assertEquals(expected, actual); assertEquals("src", filePatterns.get(0)); } AsyncRequestCallback<String> callback = (AsyncRequestCallback<String>)arguments[7]; Method onFailure = GwtReflectionUtils.getMethod(callback.getClass(), "onFailure"); onFailure.invoke(callback, mock(Throwable.class)); return callback; } }).when(service) .diff((ProjectDescriptor)anyObject(), (List<String>)anyObject(), (DiffRequest.DiffType)anyObject(), anyBoolean(), anyInt(), anyString(), anyBoolean(), (AsyncRequestCallback<String>)anyObject()); presenter.showDialog(); presenter.onDiffWithIndexClicked(); presenter.onRevisionSelected(selectedRevision); reset(view); presenter.onResourceChangesClicked(); verify(view).selectProjectChangesButton(eq(DISABLE_BUTTON)); verify(view).selectResourceChangesButton(eq(ENABLE_BUTTON)); }