@Test
  public void testFindMandatoryAttributesWithoutModelConverter() {
    final AttributeDescriptorModel attributeDescriptor1 = new AttributeDescriptorModel();
    attributeDescriptor1.setModifiers(Integer.valueOf(AttributeDescriptor.WRITE_FLAG));

    final ModelConverter nonItemModelConverter = mock(ModelConverter.class);
    final ComposedTypeModel nonItemModel = mock(ComposedTypeModel.class);
    when(converterRegistry.getModelConverterBySourceType("nonItemModel"))
        .thenReturn(nonItemModelConverter);
    when((nonItemModel).getDeclaredattributedescriptors())
        .thenReturn(Collections.singletonList(attributeDescriptor1));
    when(typeDao.findComposedTypeByCode("nonItemModel")).thenReturn(nonItemModel);

    final Set<String> actualMandatory = typeService.getMandatoryAttributes("nonItemModel", false);
    Assert.assertEquals("One attribute expected", 1, actualMandatory.size());
  }
  @Test
  public void testFindMandatoryAttributes() {
    final AttributeDescriptorModel attributeDescriptor1 = new AttributeDescriptorModel();
    attributeDescriptor1.setModifiers(Integer.valueOf(AttributeDescriptor.WRITE_FLAG));

    final Set<String> mandatory = new HashSet<String>();
    mandatory.add("mandatory1");
    final ItemModelConverter modelConverter = mock(ItemModelConverter.class);
    when(modelConverter.getMandatoryAttributes()).thenReturn(mandatory);
    when(modelConverter.getMandatoryAttributesForCreation()).thenReturn(Collections.EMPTY_SET);

    when(converterRegistry.getModelConverterBySourceType("model1")).thenReturn(modelConverter);

    Set<String> actualMandatory = typeService.getMandatoryAttributes("model1", false);
    Assert.assertEquals("One attribute expected", 1, actualMandatory.size());
    Assert.assertEquals(
        "Unexpected attribute got", "mandatory1", actualMandatory.iterator().next());
    actualMandatory = typeService.getMandatoryAttributes("model1", true);
    Assert.assertEquals(
        "Zero attributes expected with force create set", 0, actualMandatory.size());
  }