MergePresenter implements MergeView.ActionDelegate { @Override public void onReferenceSelected(@NotNull Reference reference) { selectedReference = reference; String displayName = selectedReference.getDisplayName(); boolean isEnabled = !displayName.equals(LOCAL_BRANCHES_TITLE) && !displayName.equals(REMOTE_BRANCHES_TITLE); view.setEnableMergeButton(isEnabled); } @Inject  MergePresenter(MergeView view,
                          EventBus eventBus,
                          EditorAgent editorAgent,
                          GitServiceClient service,
                          GitOutputPartPresenter console,
                          GitLocalizationConstant constant,
                          AppContext appContext,
                          NotificationManager notificationManager,
                          DtoUnmarshallerFactory dtoUnmarshallerFactory,
                          ProjectExplorerPresenter projectExplorer); void showDialog(); @Override void onCancelClicked(); @Override void onMergeClicked(); @Override void onReferenceSelected(@NotNull Reference reference); static final String LOCAL_BRANCHES_TITLE; static final String REMOTE_BRANCHES_TITLE; }
@Test public void testOnReferenceSelected() throws Exception { when(selectedReference.getDisplayName()).thenReturn(DISPLAY_NAME); presenter.onReferenceSelected(selectedReference); presenter.onMergeClicked(); verify(service).merge((ProjectDescriptor)anyObject(), eq(DISPLAY_NAME), (AsyncRequestCallback<MergeResult>)anyObject()); }