### Question:
StructuredConfigManagement extends ConfigManagementSupport { public Configuration executeLoad(int resourceId) throws PluginContainerException { ResourceConfigurationFacet facet = loadResouceConfiguratonFacet(resourceId); Configuration configuration = facet.loadStructuredConfiguration(); if (configuration == null) { return null; } ResourceType resourceType = componentService.getResourceType(resourceId); if (configuration.getNotes() == null) { configuration.setNotes("Resource config for " + resourceType.getName() + " Resource w/ id " + resourceId); } configUtilityService.normalizeConfiguration(configuration, resourceType.getResourceConfigurationDefinition()); List<String> errorMsgs = configUtilityService.validateConfiguration(configuration, resourceType.getResourceConfigurationDefinition()); logErrorMsgs(errorMsgs, resourceType); return configuration; }  Configuration executeLoad(int resourceId); void executeUpdate(int resourceId, Configuration configuration);  }### Answer:
@Test public void structuredConfigShouldGetLoaded() throws Exception { Configuration config = new Configuration(); config.put(new PropertySimple("x", "1")); config.put(new PropertySimple("y", "2")); addDefaultExpectationsForLoad(config); Configuration loadedConfig = structuredMgmt.executeLoad(resourceId); assertStructuredLoaded(config, loadedConfig); }
@Test public void theConfigNotesShouldGetSet() throws Exception { final Configuration config = new Configuration(); config.setNotes(null); addDefaultExpectationsForLoad(config); Configuration loadedConfig = structuredMgmt.executeLoad(resourceId); assertNotesSetToDefault(loadedConfig); }
@Test public void nullShouldBeReturnedWhenStructuredIsNull() throws Exception { context.checking(new Expectations() {{ atLeast(1).of(componentService).getComponent(resourceId, ResourceConfigurationFacet.class, FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT, daemonThread, onlyIfStarted); will(returnValue(configFacet)); allowing(componentService).getResourceType(resourceId); will(returnValue(resourceType)); atLeast(1).of(configFacet).loadStructuredConfiguration(); will(returnValue(null)); }}); Configuration loadedConfig = structuredMgmt.executeLoad(resourceId); assertNull(loadedConfig, "Expected null to be returned when facet returns null for structured."); }