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 testValidServiceConfig() {
        String validServiceConfig = """
                {
                  "loadBalancingConfig": [
                    {"round_robin": {}}
                  ],
                  "methodConfig": [
                    {
                      "name": [{}],
                      "retryPolicy": {
                        "maxAttempts": 5,
                        "initialBackoff": "0.05s",
                        "maxBackoff": "1s",
                        "backoffMultiplier": 2,
                        "retryableStatusCodes": [
                          "UNAVAILABLE",
                          "ABORTED",
                          "DATA_LOSS",
                          "INTERNAL",
                          "DEADLINE_EXCEEDED"
                        ]
                      },
                      "timeout": "5s"
                    }
                  ]
                }
                """;
        TestableListener listener = resolveServiceAndVerify("test1", validServiceConfig);
        NameResolver.ConfigOrError serviceConf = listener.getResult().getServiceConfig();
        assertThat(serviceConf).isNotNull();
        assertThat(serviceConf.getConfig()).isNotNull();
        assertThat(serviceConf.getError()).isNull();
    }