### Question:
StructuredConfigManagement extends ConfigManagementSupport { public void executeUpdate(int resourceId, Configuration configuration) throws PluginContainerException { try { ResourceConfigurationFacet facet = loadResourceConfigFacetWithWriteLock(resourceId); facet.validateStructuredConfiguration(configuration); facet.persistStructuredConfiguration(configuration); } catch (Throwable t) { throw new ConfigurationUpdateException(t.getMessage()); } }  Configuration executeLoad(int resourceId); void executeUpdate(int resourceId, Configuration configuration);  }### Answer:
@Test public void facetShouldBeCalledToUpdateStructured() throws Exception { final Configuration config = new Configuration(); addDefaultExpectationsForUpdate(); context.checking(new Expectations() {{ oneOf(configFacet).validateStructuredConfiguration(config); oneOf(configFacet).persistStructuredConfiguration(config); }}); structuredMgmt.executeUpdate(resourceId, config); }
@Test(expectedExceptions = {ConfigurationUpdateException.class}) public void exceptionShouldBeThrownWhenValidationFails() throws Exception { final Configuration config = new Configuration(); addDefaultExpectationsForUpdate(); context.checking(new Expectations() {{ oneOf(configFacet).validateStructuredConfiguration(config); will(throwException(new RuntimeException())); }}); structuredMgmt.executeUpdate(resourceId, config); }
@Test(expectedExceptions = {ConfigurationUpdateException.class}) public void exceptionShouldBeThrownWhenUpdateFails() throws Exception { final Configuration config = new Configuration(); addDefaultExpectationsForUpdate(); context.checking(new Expectations() {{ oneOf(configFacet).validateStructuredConfiguration(config); oneOf(configFacet).persistStructuredConfiguration(config); will(throwException(new RuntimeException())); }}); structuredMgmt.executeUpdate(resourceId, config); }