### Question:
JsonContainerConfig extends AbstractContainerConfig { @Override public String toString() { return JsonSerializer.serialize(config); } JsonContainerConfig(String containers, Expressions expressions); @Inject  JsonContainerConfig(@Named("shindig.containers.default") String containers,
                             @Nullable @Named("shindig.host") String host,
                             @Nullable @Named("shindig.port") String port,
                             Expressions expressions);  JsonContainerConfig(JSONObject json, Expressions expressions); @Override Collection<String> getContainers(); @Override Map<String, Object> getProperties(String container); @Override Object getProperty(String container, String property); @Override String toString(); static final char FILE_SEPARATOR; static final String PARENT_KEY; static final String CONTAINER_KEY; static final String SERVER_PORT; static final String SERVER_HOST; }### Answer:
@Test public void parseWithDefaultInheritance() throws Exception { JSONObject json = new JSONObject(); json.put(CONTAINER_KEY, new String[]{CHILD_CONTAINER}); json.put(PARENT_KEY, DEFAULT_CONTAINER); json.put(ARRAY_NAME, ARRAY_ALT_VALUE); JSONObject nested = new JSONObject(); nested.put(NESTED_NAME, NESTED_ALT_VALUE); json.put(NESTED_KEY, nested); File childFile = createContainer(json); File parentFile = createDefaultContainer(); ContainerConfig config = new JsonContainerConfig(childFile.getAbsolutePath() + JsonContainerConfig.FILE_SEPARATOR + parentFile.getAbsolutePath(), Expressions.forTesting()); String value = config.getString(CHILD_CONTAINER, TOP_LEVEL_NAME); assertEquals(TOP_LEVEL_VALUE, value); Map<String, Object> nestedObj = config.getMap(CHILD_CONTAINER, NESTED_KEY); String nestedValue = nestedObj.get(NESTED_NAME).toString(); assertEquals(NESTED_ALT_VALUE, nestedValue); String arrayValue = config.getString(CHILD_CONTAINER, ARRAY_NAME); assertEquals(ARRAY_ALT_VALUE, arrayValue); List<String> actual = new ArrayList<String>(); for (Object val : config.getList(DEFAULT_CONTAINER, ARRAY_NAME)) { actual.add(val.toString()); } List<String> expected = Arrays.asList(ARRAY_VALUE); assertEquals(expected, actual); }