protected String getServiceConfig(final List<ServiceInstance> instances) {
        for (final ServiceInstance inst : instances) {
            final Map<String, String> metadata = inst.getMetadata();
            if (metadata == null || metadata.isEmpty()) {
                continue;
            }
            final String metaValue = metadata.get(CLOUD_DISCOVERY_METADATA_SERVICE_CONFIG);
            if (metaValue != null && !metaValue.isEmpty()) {
                return metaValue;
            }
        }
        return null;
    }
@Test
    void testBrokenServiceConfig() {
        TestableListener listener = resolveServiceAndVerify("test2", "intentionally invalid service config");
        NameResolver.ConfigOrError serviceConf = listener.getResult().getServiceConfig();
        assertThat(serviceConf).isNotNull();
        assertThat(serviceConf.getConfig()).isNull();
        assertThat(serviceConf.getError()).extracting(Status::getCode).isEqualTo(Status.Code.UNKNOWN);
    }