@Override
    public List<ServiceDefinition> apply(Exchange exchange, List<ServiceDefinition> services) {
        for (int i = 0; i < delegatesSize; i++) {
            services = delegates.get(i).apply(exchange, services);
        }

        return services;
    }
@Test
    public void testContentBasedServiceFilterCombinedWithServiceFilter() throws Exception {
        CombinedServiceCallServiceFilterConfiguration conf = new CombinedServiceCallServiceFilterConfiguration()
                .healthy()
                .custom((exchange, services) -> services.stream()
                        .filter(serviceDefinition -> ofNullable(serviceDefinition.getMetadata()
                                .get("supports"))
                                .orElse("")
                                .contains(exchange.getProperty("needs", String.class)))
                        .toList());

        Map<String, String> metadata = Collections.singletonMap("supports", "foo,bar");

        Exchange exchange = new DefaultExchange(context);
        exchange.setProperty("needs", "foo");

        List<ServiceDefinition> services = conf.newInstance(context).apply(exchange, Arrays.asList(
                new DefaultServiceDefinition("no-name", "127.0.0.1", 2001, metadata, new DefaultServiceHealth(true)),
                new DefaultServiceDefinition("no-name", "127.0.0.1", 2002, metadata, new DefaultServiceHealth(false))));

        assertEquals(1, services.size());
        assertFalse(services.stream().anyMatch(s -> !s.getHealth().isHealthy()));
        assertTrue(services.stream().anyMatch(s -> s.getPort() == 2001));
    }