@Override
    public <S, C extends Config<S>> C createConfig(S subject, Class<C> configClass) {
        ConfigFactory<S, C> factory = getConfigFactory(configClass);
        Versioned<JsonNode> json = configs.computeIfAbsent(key(subject, configClass),
                                                             k -> factory.isList() ?
                                                                     mapper.createArrayNode() :
                                                                     mapper.createObjectNode());
        return createConfig(subject, configClass, json.value());
    }
@Test
    public void testCreateConfig() {
        configStore.addConfigFactory(new MockConfigFactory(BasicConfig.class, "config1"));

        configStore.createConfig("config1", BasicConfig.class);
        assertThat(configStore.getConfigClasses("config1"), hasSize(1));
        assertThat(configStore.getSubjects(String.class, BasicConfig.class), hasSize(1));
        assertThat(configStore.getSubjects(String.class), hasSize(1));

        BasicConfig queried = configStore.getConfig("config1", BasicConfig.class);
        assertThat(queried, notNullValue());

        configStore.clearConfig("config1", BasicConfig.class);
        assertThat(configStore.getConfigClasses("config1"), hasSize(0));
        assertThat(configStore.getSubjects(String.class, BasicConfig.class), hasSize(0));
        assertThat(configStore.getSubjects(String.class), hasSize(0));

        BasicConfig queriedAfterClear = configStore.getConfig("config1", BasicConfig.class);
        assertThat(queriedAfterClear, nullValue());
    }