public static Map<String, Set<String>> getService2ClusterMapping(List<Cluster> clusters) {
        Map<String, Set<String>> nameMapping = new HashMap<>();
        for (Cluster cluster : clusters) {
            if (cluster == null) {
                continue;
            }
            Optional<String> serviceNameFromCluster = getServiceNameFromCluster(cluster.getName());
            if (!serviceNameFromCluster.isPresent()) {
                continue;
            }
            String serviceName = serviceNameFromCluster.get();
            nameMapping.computeIfAbsent(serviceName, key -> new HashSet<>()).add(cluster.getName());
        }
        return nameMapping;
    }
@Test
    public void testGetService2ClusterMapping() {
        List<Cluster> clusters = Arrays.asList(
                null,
                createCluster("outbound|8080||serviceA.default.svc.cluster.local"),
                createCluster("outbound|8080|subset1|serviceB.default.svc.cluster.local"),
                createCluster("outbound|8080|subset2|serviceB.default.svc.cluster.local"),
                createCluster("outbound|8080|serviceC.default.svc.cluster.local"),
                createCluster(null)
        );

        Map<String, Set<String>> result = XdsProtocolTransformer.getService2ClusterMapping(clusters);
        Assert.assertEquals(2, result.size());
        Assert.assertTrue(result.containsKey("serviceA"));
        Assert.assertTrue(result.containsKey("serviceB"));
        Assert.assertEquals(1, result.get("serviceA").size());
        Assert.assertEquals(2, result.get("serviceB").size());
    }