@Test
 public void testFindTypeForNonExistingCode() {
   when(typeDao.findTypeByCode("noCodeFound"))
       .thenThrow(new UnknownIdentifierException("Identifier not found"));
   try {
     typeService.getTypeForCode("noCodeFound");
     Assert.fail("Non existing component model found!");
   } catch (final UnknownIdentifierException e) {
     // perfectly ok
   }
 }
  @Test
  public void testFindTypeForAmbiguousCode() {
    final List<TypeModel> multiModel = new ArrayList<TypeModel>();
    multiModel.add(model1);
    multiModel.add(model2);
    when(typeDao.findTypeByCode("multiCodeFound"))
        .thenThrow(new AmbiguousIdentifierException("Ambiguous identifier multiCodeFound"));

    try {
      typeService.getTypeForCode("multiCodeFound");
      Assert.fail("Not failed after more than one component model found!");
    } catch (final AmbiguousIdentifierException e) {
      // perfectly ok
    }
  }