ProcessDefinitionListPresenter extends AbstractMultiGridPresenter<ProcessSummary, ProcessDefinitionListPresenter.ProcessDefinitionListView> { public Predicate<ProcessSummary> getViewProcessInstanceActionCondition() { return pis -> isUserAuthorizedForPerspective(PROCESS_INSTANCES); } ProcessDefinitionListPresenter(); @Inject void setAuthorizationManager(final AuthorizationManager authorizationManager); @Inject void setProcessDefinitionListBasicFiltersPresenter(final ProcessDefinitionListBasicFiltersPresenter processDefinitionListBasicFiltersPresenter); @Override void setupActiveSearchFilters(); @Override boolean existActiveSearchFilters(); @Override void createListBreadcrumb(); void setupDetailBreadcrumb(String detailLabel); void openGenericForm(final String processDefId,
                                final String deploymentId,
                                final String processDefName,
                                final boolean isDynamic); @Inject void setFilterSettingsManager(final ProcessDefinitionListFilterSettingsManager filterSettingsManager); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); void refreshNewProcessInstance(@Observes NewProcessInstanceEvent newProcessInstance); void refreshNewCaseInstance(@Observes NewCaseInstanceEvent newCaseInstance); Predicate<ProcessSummary> getViewProcessInstanceActionCondition(); Predicate<ProcessSummary> getStartCondition(); void viewProcessInstances(String processDefId); boolean isUserAuthorizedForPerspective(final String perspectiveId); @Inject void setProcessRuntimeDataService(final Caller<ProcessRuntimeDataService> processRuntimeDataService);  }
@Test public void testViewProcessInstanceActionCondition() { doAnswer(new PerspectiveAnswer(PROCESS_INSTANCES)).when(authorizationManager).authorize(any(ResourceRef.class), eq(identity)); assertTrue(presenter.getViewProcessInstanceActionCondition().test(new ProcessSummary())); when(authorizationManager.authorize(any(ResourceRef.class), eq(identity))).thenReturn(false); assertFalse(presenter.getViewProcessInstanceActionCondition().test(new ProcessSummary())); }