### Question:
ClusterControllerImpl implements ClusterController { @Override public RequestStatus createResources(Type type, Request request) throws UnsupportedPropertyException, SystemException, ResourceAlreadyExistsException, NoSuchParentResourceException { ResourceProvider provider = ensureResourceProvider(type); if (provider != null) { checkProperties(type, request, null); return provider.createResources(request); } return null; } ClusterControllerImpl(ProviderModule providerModule); @Override Predicate getAmendedPredicate(Type type, Predicate predicate); @Override QueryResponse getResources(Type type, Request request, Predicate predicate); @Override Set<Resource> populateResources(Type type,
                                         Set<Resource> resources,
                                         Request request,
                                         Predicate predicate); @Override Iterable<Resource> getIterable(Type type, QueryResponse queryResponse,
                                        Request request, Predicate predicate,
                                        PageRequest pageRequest,
                                        SortRequest sortRequest); @Override PageResponse getPage(Type type, QueryResponse queryResponse,
                              Request request, Predicate predicate,
                              PageRequest pageRequest, SortRequest sortRequest); @Override Schema getSchema(Type type); @Override RequestStatus createResources(Type type, Request request); @Override RequestStatus updateResources(Type type, Request request, Predicate predicate); @Override RequestStatus deleteResources(Type type, Request request, Predicate predicate); @Override ResourceProvider ensureResourceProvider(Type type);  }### Answer:
@Test public void testCreateResources() throws Exception{ TestProviderModule providerModule = new TestProviderModule(); TestHostResourceProvider resourceProvider = (TestHostResourceProvider) providerModule.getResourceProvider(Resource.Type.Host); ClusterController controller = new ClusterControllerImpl(providerModule); Set<Map<String, Object>> properties = new HashSet<>(); Map<String, Object> propertyMap = new HashMap<>(); propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99); propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2); properties.add(propertyMap); Request request = PropertyHelper.getCreateRequest(properties, null); controller.createResources(Resource.Type.Host, request); Assert.assertEquals(TestHostResourceProvider.Action.Create, resourceProvider.getLastAction()); Assert.assertSame(request, resourceProvider.getLastRequest()); Assert.assertNull(resourceProvider.getLastPredicate()); }
@Test public void testCreateResourcesWithUnsupportedProperty() throws Exception{ TestProviderModule providerModule = new TestProviderModule(); ClusterController controller = new ClusterControllerImpl(providerModule); Set<Map<String, Object>> properties = new HashSet<>(); Map<String, Object> propertyMap = new HashMap<>(); propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99); propertyMap.put(UNSUPPORTED_PROPERTY, 2); properties.add(propertyMap); Request request = PropertyHelper.getCreateRequest(properties, null); try { controller.createResources(Resource.Type.Host, request); Assert.fail("Expected an UnsupportedPropertyException for the unsupported properties."); } catch (UnsupportedPropertyException e) { } }