### Question:
AmbariServerConfigurationHandler extends RootServiceComponentConfigurationHandler { @Override public void removeComponentConfiguration(String categoryName) { if (null == categoryName) { LOGGER.debug("No resource id provided in the request"); } else { LOGGER.debug("Deleting Ambari configuration with id: {}", categoryName); if (ambariConfigurationDAO.removeByCategory(categoryName) > 0) { publisher.publish(new AmbariConfigurationChangedEvent(categoryName)); } } } @Inject  AmbariServerConfigurationHandler(AmbariConfigurationDAO ambariConfigurationDAO, AmbariEventPublisher publisher, Configuration ambariConfiguration); @Override Map<String, RootServiceComponentConfiguration> getComponentConfigurations(String categoryName); @Override void removeComponentConfiguration(String categoryName); @Override void updateComponentCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified); @Override OperationResult performOperation(String categoryName, Map<String, String> properties,
                                          boolean mergeExistingProperties, String operation,
                                          Map<String, Object> operationParameters); Map<String, Map<String, String>> getConfigurations(); Map<String, String> getConfigurationProperties(String categoryName);  }### Answer:
@Test public void removeComponentConfiguration() { AmbariConfigurationDAO ambariConfigurationDAO = createMock(AmbariConfigurationDAO.class); expect(ambariConfigurationDAO.removeByCategory(SSO_CONFIGURATION.getCategoryName())).andReturn(1).once(); expect(ambariConfigurationDAO.removeByCategory("invalid category")).andReturn(0).once(); AmbariEventPublisher publisher = createMock(AmbariEventPublisher.class); publisher.publish(anyObject(AmbariConfigurationChangedEvent.class)); expectLastCall().once(); Configuration configuration = createMock(Configuration.class); replayAll(); AmbariServerConfigurationHandler handler = new AmbariServerConfigurationHandler(ambariConfigurationDAO, publisher, configuration); handler.removeComponentConfiguration(SSO_CONFIGURATION.getCategoryName()); handler.removeComponentConfiguration("invalid category"); verifyAll(); }