@Test
  public void testGetAllUserWorkflowActionsWithAttachmentsWhenUnknownClass() {
    // given
    final String COMPOSED_TYPE_CODE = "unknownClass";
    final List<WorkflowActionModel> actions = new ArrayList<WorkflowActionModel>();
    actions.add(mock(WorkflowActionModel.class));
    final ComposedTypeModel mockProductComposedType = mock(ComposedTypeModel.class);
    when(typeService.getComposedTypeForCode(COMPOSED_TYPE_CODE))
        .thenThrow(new UnknownIdentifierException(""));
    when(typeService.getComposedTypeForClass(ProductModel.class))
        .thenReturn(mockProductComposedType);
    when(workflowActionDao.findWorkflowActionsByStatusAndAttachmentType(
            Collections.singletonList(mockProductComposedType),
            Collections.singletonList(WorkflowActionStatus.IN_PROGRESS)))
        .thenReturn(actions);

    final List<String> attachmentTypes = new ArrayList<String>();
    attachmentTypes.add(COMPOSED_TYPE_CODE);

    // when
    final List<WorkflowActionModel> endWorkflowActions =
        workflowActionService.getAllUserWorkflowActionsWithAttachments(attachmentTypes);

    // then
    assertThat(endWorkflowActions).isEmpty();
  }
  @Test
  public void testGetWorkflowActionsByType() {
    // given
    final List<WorkflowActionModel> mockActions = new ArrayList<WorkflowActionModel>();
    when(workflowActionDao.findWorkflowActionsByType(WorkflowActionType.END, workflow))
        .thenReturn(mockActions);

    // when
    final List<WorkflowActionModel> actions =
        workflowActionService.getWorkflowActionsByType(WorkflowActionType.END, workflow);

    // then
    assertThat(actions).isSameAs(mockActions);
  }
  @Test
  public void testGetNormalWorkflowActions() {
    // given
    final List<WorkflowActionModel> actions = new ArrayList<WorkflowActionModel>();
    actions.add(mock(WorkflowActionModel.class));
    when(workflowActionDao.findNormalWorkflowActions(workflow)).thenReturn(actions);

    // when
    final List<WorkflowActionModel> endWorkflowActions =
        workflowActionService.getNormalWorkflowActions(workflow);

    // then

    assertThat(endWorkflowActions).isSameAs(actions);
  }
  @Test
  public void testGetAllUserWorkflowActionsWithAttachmentForString() {
    // given
    final List<WorkflowActionModel> actions = new ArrayList<WorkflowActionModel>();
    actions.add(mock(WorkflowActionModel.class));
    final ComposedTypeModel mockProductComposedType = mock(ComposedTypeModel.class);
    when(mockProductComposedType.getJaloclass()).thenReturn(Product.class);
    when(typeService.getComposedTypeForCode(ProductModel._TYPECODE))
        .thenReturn(mockProductComposedType);
    when(workflowActionDao.findWorkflowActionsByStatusAndAttachmentType(
            Collections.singletonList(mockProductComposedType),
            Collections.singletonList(WorkflowActionStatus.IN_PROGRESS)))
        .thenReturn(actions);

    // when
    final List<WorkflowActionModel> endWorkflowActions =
        workflowActionService.getAllUserWorkflowActionsWithAttachment(ProductModel._TYPECODE);

    // then
    assertThat(endWorkflowActions).isSameAs(actions);
  }