@Test
public void testCreateResource_BlueprintFactoryThrowsException() throws Exception
{

  Request request = createMock(Request.class);
  Set<Map<String, Object>> setProperties = getBlueprintTestProperties();
  setProperties.iterator().next().remove(BlueprintResourceProvider.HOST_GROUP_PROPERTY_ID);
  Map<String, String> requestInfoProperties = getTestRequestInfoProperties();
  // set expectations
  expect(blueprintFactory.createBlueprint(setProperties.iterator().next(), null)).andThrow(
    new IllegalArgumentException("Blueprint name must be provided"));
  expect(securityFactory.createSecurityConfigurationFromRequest(null,true)).andReturn(null).anyTimes();
  expect(request.getProperties()).andReturn(setProperties);
  expect(request.getRequestInfoProperties()).andReturn(requestInfoProperties);
  replay(dao, entity, metaInfo, blueprintFactory, securityFactory, blueprint, request);
  // end expectations
  try {
    provider.createResources(request);
    fail("Exception expected");
  } catch (IllegalArgumentException e) {
    // expected
  }
  verify(dao, entity, blueprintFactory, metaInfo, request);
}