ProcessInstanceListPresenter extends AbstractMultiGridPresenter<ProcessInstanceSummary, ProcessInstanceListPresenter.ProcessInstanceListView> { @Override public Predicate<ProcessInstanceSummary> getViewErrorsActionCondition() { return pis -> isUserAuthorizedForPerspective(EXECUTION_ERRORS) && pis.getErrorCount() != null && pis.getErrorCount() > 0; }  @Inject void setProcessInstanceSelectedEvent(final Event<ProcessInstanceSelectionEvent> processInstanceSelectionEvent); @Override void createListBreadcrumb(); void setupDetailBreadcrumb(String detailLabel); void getDomainSpecifDataForProcessInstances(final Integer startRange,
                                                       final List<ProcessInstanceSummary> instancesFromDataSet,
                                                       final Boolean lastPage); void newInstanceCreated(@Observes final NewProcessInstanceEvent pi); void newInstanceCreated(@Observes final ProcessInstancesUpdateEvent pis); void abortProcessInstance(String containerId,
                                     long processInstanceId); void abortProcessInstances(Map<String, List<Long>> containerInstances); void bulkSignal(List<ProcessInstanceSummary> processInstances); void bulkAbort(List<ProcessInstanceSummary> processInstances); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); void signalProcessInstance(final ProcessInstanceSummary processInstance); @Override void selectSummaryItem(final ProcessInstanceSummary summary); void refreshDetailBreadcrumb(@Observes ProcessInstanceSelectionEvent event); void formClosed(@Observes BeforeClosePlaceEvent closed); @Inject void setFilterSettingsManager(final ProcessInstanceListFilterSettingsManager filterSettingsManager); @Inject void setProcessService(final Caller<ProcessService> processService); @Override void setupActiveSearchFilters(); @Override boolean existActiveSearchFilters(); @Override ActiveFilterItem getActiveFilterFromColumnFilter(ColumnFilter columnFilter); String getStatusColumnFilterDescription(ColumnFilter columnFilter); void openJobsView(final String pid); void openTaskView(final String pid); @Override void openErrorView(final String pid); Predicate<ProcessInstanceSummary> getSignalActionCondition(); Predicate<ProcessInstanceSummary> getAbortActionCondition(); Predicate<ProcessInstanceSummary> getViewJobsActionCondition(); Predicate<ProcessInstanceSummary> getViewTasksActionCondition(); @Override Predicate<ProcessInstanceSummary> getViewErrorsActionCondition();  }
@Test public void testViewErrorsActionCondition() { doAnswer(new PerspectiveAnswer(EXECUTION_ERRORS)).when(authorizationManager).authorize(any(ResourceRef.class), eq(identity)); ProcessInstanceSummary okProcInst = new ProcessInstanceSummary(); ProcessInstanceSummary errProcInst = new ProcessInstanceSummary(); errProcInst.setErrorCount(1); Predicate<ProcessInstanceSummary> viewErrCondition = presenter.getViewErrorsActionCondition(); assertFalse(viewErrCondition.test(okProcInst)); assertTrue(viewErrCondition.test(errProcInst)); when(authorizationManager.authorize(any(ResourceRef.class), eq(identity))).thenReturn(false); assertFalse(viewErrCondition.test(okProcInst)); assertFalse(viewErrCondition.test(errProcInst)); }