@Override
    public SortedSet<BrokerStatus> getAvailablePrimaryBrokers(SortedSet<BrokerStatus> primaryCandidates) {
        SortedSet<BrokerStatus> availablePrimaries = new TreeSet<BrokerStatus>();
        for (BrokerStatus status : primaryCandidates) {
            if (this.autoFailoverPolicy.isBrokerAvailable(status)) {
                availablePrimaries.add(status);
            }
        }
        return availablePrimaries;
    }
@Test
    public void testGetAvailablePrimaryBrokers() throws Exception {
        NamespaceIsolationPolicyImpl defaultPolicy = this.getDefaultPolicy();
        SortedSet<BrokerStatus> brokerStatus = new TreeSet<>();
        SortedSet<BrokerStatus> expectedAvailablePrimaries = new TreeSet<>();
        for (int i = 0; i < 10; i++) {
            BrokerStatus status = BrokerStatus.builder()
                    .brokerAddress(String.format("prod1-broker%d.messaging.use.example.com", i))
                    .active(i % 2 == 0)
                    .loadFactor(i * 10)
                    .build();
            brokerStatus.add(status);
            if (i % 2 == 0) {
                expectedAvailablePrimaries.add(status);
            }
        }

        SortedSet<BrokerStatus> availablePrimaries = defaultPolicy.getAvailablePrimaryBrokers(brokerStatus);
        assertEquals(expectedAvailablePrimaries.size(), availablePrimaries.size());
        for (BrokerStatus bs : availablePrimaries) {
            if (!expectedAvailablePrimaries.contains(bs)) {
                fail("Should not happen");
            }
        }

    }