@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 testUniqueNullAttributeSlayerAPI() {

    final ComposedTypeModel typeUnderInvestigation =
        typeService.getComposedTypeForClass(LinkModel.class);
    final AttributeDescriptorModel attributeDesc =
        typeService.getAttributeDescriptor(typeUnderInvestigation, LinkModel.LANGUAGE);
    Assert.assertTrue(attributeDesc.getOptional().booleanValue());
    Assert.assertTrue(attributeDesc.getUnique().booleanValue());

    final LinkModel link1 = modelService.create(LinkModel.class);
    link1.setQualifier("link1");
    link1.setSource(source);
    link1.setTarget(target);
    // the optional unique attribute
    link1.setLanguage(language);

    modelService.save(link1); // <-- OK!

    final LinkModel link2 = modelService.create(LinkModel.class);
    link2.setQualifier("link2");
    link2.setSource(source);
    link2.setTarget(target);
    // the optional unique attribute
    link2.setLanguage(null);

    modelService.save(link2); // <-- OK! //<-- still OK, only one null value!

    final LinkModel link3 = modelService.create(LinkModel.class);
    link3.setQualifier("link3");
    link3.setSource(source);
    link3.setTarget(target);
    // the optional unique attribute
    link3.setLanguage(null);

    boolean success = false;
    try {
      modelService.save(link3); // <-- what happens now?!
      Assert.fail(
          "Should have failed with 'ModelSavingException' for ambiguous unique attribute, which is 'null'");
    } catch (final ModelSavingException e) {
      success = true;
    }
    Assert.assertTrue(
        "Should have failed with 'ModelSavingException' for ambiguous unique attribute, which is 'null'",
        success);
  }