### Question:
ConfigManager { public static Hashtable<String, Object> getConfigurationsMap() { JsonArray propertySourcesArray = new JsonArray(); Hashtable<String, Object> appPropsHashtable = new Hashtable<>(); Hashtable<String, Object> rulePropsHashtable = new Hashtable<>(); Hashtable<String, Object> configHashtable = new Hashtable<>(); String configServerURL = PacmanUtils.getEnvironmentVariable(PacmanSdkConstants.CONFIG_SERVICE_URL); String configCredentials = PacmanUtils.getEnvironmentVariable(PacmanSdkConstants.CONFIG_CREDENTIALS); if (StringUtils.isNullOrEmpty(configServerURL) || StringUtils.isNullOrEmpty(configCredentials)) { logger.info(PacmanSdkConstants.MISSING_CONFIGURATION); throw new InvalidInputException(PacmanSdkConstants.MISSING_CONFIGURATION); } Map<String, String> configCreds = PacmanUtils.getHeader(configCredentials); JsonObject configurationsFromPacmanTable = PacmanUtils.getConfigurationsFromConfigApi(configServerURL, configCreds); logger.info("Configured values {} ",configurationsFromPacmanTable); if (configurationsFromPacmanTable != null) { propertySourcesArray = configurationsFromPacmanTable.get("propertySources").getAsJsonArray(); } if (propertySourcesArray.size() > 0) { for (int i = 0; i < propertySourcesArray.size(); i++) { JsonObject propertySource = (JsonObject) propertySourcesArray.get(i); if(propertySource.has(PacmanSdkConstants.NAME)) { if (propertySource.get(PacmanSdkConstants.NAME).toString().contains("application")) { JsonObject appProps = propertySource.get(PacmanSdkConstants.SOURCE).getAsJsonObject(); appPropsHashtable = new Gson().fromJson(appProps,new TypeToken<Hashtable<String, Object>>() {}.getType()); } if (propertySource.get(PacmanSdkConstants.NAME).toString().contains("rule")) { JsonObject ruleProps = propertySource.get(PacmanSdkConstants.SOURCE).getAsJsonObject(); rulePropsHashtable = new Gson().fromJson(ruleProps,new TypeToken<Hashtable<String, Object>>() {}.getType()); } } } } else { logger.info(PacmanSdkConstants.MISSING_DB_CONFIGURATION); throw new InvalidInputException(PacmanSdkConstants.MISSING_DB_CONFIGURATION); } configHashtable.putAll(appPropsHashtable); configHashtable.putAll(rulePropsHashtable); return configHashtable; }  static Hashtable<String, Object> getConfigurationsMap();  }### Answer:
@Test public void getConfigurationsMapTest() throws Exception { String str = "{\"name\":\"123\",\"profiles\":[\"123\"],\"label\":\"123\",\"version\":null,\"state\":null,\"propertySources\":[{\"name\":\"rule-stg\",\"source\":{\"test\":\"test\"}},{\"name\":\"application-stg\",\"source\":{\"test\":\"test\"}}]}"; JsonParser jsonParser = new JsonParser(); JsonObject jo = (JsonObject)jsonParser.parse(str); mockStatic(PacmanUtils.class); when(PacmanUtils.getEnvironmentVariable(anyString())).thenReturn("123"); when(PacmanUtils.getHeader(anyString())).thenReturn(new HashMap<String, String>()); when(PacmanUtils.getConfigurationsFromConfigApi(anyString(),anyObject())).thenReturn(jo); assertThat(configManager.getConfigurationsMap(), is(notNullValue())); when(PacmanUtils.getConfigurationsFromConfigApi(anyString(),anyObject())).thenReturn(jo); assertThat(configManager.getConfigurationsMap(), is(notNullValue())); when(PacmanUtils.getEnvironmentVariable(anyString())).thenReturn(null); assertThatThrownBy( () -> configManager.getConfigurationsMap()).isInstanceOf(InvalidInputException.class); }