### Question:
ConsulConfig extends AbstractRestInterface implements IConsulConfig { public List<ConfigItem> getConfigForService(String serviceId) { Map<String, String> keyValues = ConsulUtil.getKeyValue(ConsulSpConfig.SERVICE_ROUTE_PREFIX + serviceId); List<ConfigItem> configItems = new LinkedList<>(); for (Map.Entry<String, String> entry : keyValues.entrySet()) { ConfigItem configItem = new Gson().fromJson(entry.getValue(), ConfigItem.class); configItem.setKey(entry.getKey()); configItems.add(configItem); } return configItems; }  @GET @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Override Response getAllServiceConfigs(); @POST @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Override Response saveServiceConfig(PeConfig peConfig); @DELETE @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Override Response deleteService(String serviceName); @GET @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Path("/messaging") @Override Response getMessagingSettings(); @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @GsonWithIds @Path("messaging") @Override Response updateMessagingSettings(MessagingSettings messagingSettings); List<ConfigItem> getConfigForService(String serviceId);  }### Answer:
@Test public void getConfigForService() { Map<String, String> keyValues = new HashMap<>(); JsonObject valueObject = new JsonObject(); valueObject.addProperty("description", "description value"); valueObject.addProperty("value", "5984"); valueObject.addProperty("valueType", "xs:integer"); valueObject.addProperty("configurationScope", "CONTAINER_STARTUP_CONFIG"); valueObject.addProperty("isPassword", "false"); keyValues.put("key_01", valueObject.toString()); PowerMockito.mockStatic(ConsulUtil.class); Mockito.when(ConsulUtil.getKeyValue(anyString())) .thenReturn(keyValues); ConsulConfig consulConfig = new ConsulConfig(); List<ConfigItem> result = consulConfig.getConfigForService("service_id"); assertNotNull(result); assertEquals(1, result.size()); ConfigItem configItem = result.get(0); assertEquals("description value", configItem.getDescription()); assertEquals("5984", configItem.getValue()); assertEquals("xs:integer", configItem.getValueType()); assertEquals(false, configItem.isPassword()); assertEquals("key_01", configItem.getKey()); }