@Override
    public <T> T get(String key, Class<T> type) {
        ClusterConfig config = findClusterConfig(key);

        if (config == null) {
            LOG.debug("Couldn't find cluster config of type {}", key);
            return null;
        }

        T result = extractPayload(config.payload(), type);
        if (result == null) {
            LOG.error("Couldn't extract payload from cluster config (type: {})", key);
        }

        return result;
    }
@Test
    public void getReturnsExistingConfig() throws Exception {
        DBObject dbObject = new BasicDBObjectBuilder()
                .add("type", CustomConfig.class.getCanonicalName())
                .add("payload", Collections.singletonMap("text", "TEST"))
                .add("last_updated", TIME.toString())
                .add("last_updated_by", "ID")
                .get();
        @SuppressWarnings("deprecation")
        final DBCollection collection = mongoConnection.getDatabase().getCollection(COLLECTION_NAME);
        collection.save(dbObject);

        assertThat(collection.count()).isEqualTo(1L);

        CustomConfig customConfig = clusterConfigService.get(CustomConfig.class);
        assertThat(customConfig.text).isEqualTo("TEST");
    }