### Question:
AmbariServerConfigurationHandler extends RootServiceComponentConfigurationHandler { public Map<String, Map<String, String>> getConfigurations() { Map<String, Map<String, String>> configurations = new HashMap<>(); List<AmbariConfigurationEntity> entities = ambariConfigurationDAO.findAll(); if (entities != null) { for (AmbariConfigurationEntity entity : entities) { String category = entity.getCategoryName(); Map<String, String> configuration = configurations.computeIfAbsent(category, k -> new HashMap<>()); configuration.put(entity.getPropertyName(), entity.getPropertyValue()); } } return configurations; } @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 getConfigurations() { List<AmbariConfigurationEntity> ssoEntities = new ArrayList<>(); ssoEntities.add(createEntity(SSO_CONFIGURATION.getCategoryName(), SSO_MANAGE_SERVICES.key(), "true")); ssoEntities.add(createEntity(SSO_CONFIGURATION.getCategoryName(), SSO_ENABLED_SERVICES.key(), "AMBARI,SERVICE1")); List<AmbariConfigurationEntity> allEntities = new ArrayList<>(ssoEntities); allEntities.add(createEntity(LDAP_CONFIGURATION.getCategoryName(), LDAP_ENABLED.key(), "true")); allEntities.add(createEntity(LDAP_CONFIGURATION.getCategoryName(), SERVER_HOST.key(), "host1")); AmbariConfigurationDAO ambariConfigurationDAO = createMock(AmbariConfigurationDAO.class); expect(ambariConfigurationDAO.findAll()).andReturn(allEntities).once(); AmbariEventPublisher publisher = createMock(AmbariEventPublisher.class); Configuration configuration = createMock(Configuration.class); replayAll(); AmbariServerConfigurationHandler handler = new AmbariServerConfigurationHandler(ambariConfigurationDAO, publisher, configuration); Map<String, Map<String, String>> allConfigurations = handler.getConfigurations(); Assert.assertEquals(2, allConfigurations.size()); Assert.assertTrue(allConfigurations.containsKey(SSO_CONFIGURATION.getCategoryName())); Assert.assertTrue(allConfigurations.containsKey(LDAP_CONFIGURATION.getCategoryName())); verifyAll(); }