WorkflowInstanceService { public WorkflowInstance getWorkflowInstance(long id, Set<WorkflowInstanceInclude> includes, Long maxActions) { try { return workflowInstanceDao.getWorkflowInstance(id, includes, maxActions); } catch (EmptyResultDataAccessException e) { throw new NflowNotFoundException("Workflow instance", id, e); } } @Inject  WorkflowInstanceService(WorkflowInstanceDao workflowInstanceDao, WorkflowDefinitionService workflowDefinitionService,
      WorkflowInstancePreProcessor workflowInstancePreProcessor); WorkflowInstance getWorkflowInstance(long id, Set<WorkflowInstanceInclude> includes, Long maxActions); @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "getInitialState().toString() has no cast") long insertWorkflowInstance(WorkflowInstance instance); @Transactional boolean updateWorkflowInstance(WorkflowInstance instance, WorkflowInstanceAction action); @Transactional boolean wakeupWorkflowInstance(long id, List<String> expectedStates); Collection<WorkflowInstance> listWorkflowInstances(QueryWorkflowInstances query); Stream<WorkflowInstance> listWorkflowInstancesAsStream(QueryWorkflowInstances query); Optional<Integer> getSignal(long workflowInstanceId); boolean setSignal(long workflowInstanceId, Optional<Integer> signal, String reason, WorkflowActionType actionType);  }
@Test public void getWorkflowInstance() { WorkflowInstance instance = Mockito.mock(WorkflowInstance.class); @SuppressWarnings("unchecked") Set<WorkflowInstanceInclude> includes = Mockito.mock(Set.class); when(workflowInstanceDao.getWorkflowInstance(42, includes, 10L)).thenReturn(instance); assertEquals(instance, service.getWorkflowInstance(42, includes, 10L)); }