public boolean hasOnlineDir(Uuid dir) {
        return DirectoryId.isOnline(dir, directories);
    }
@Test
    void testHasOnlineDir() {
        BrokerRegistration registration = new BrokerRegistration.Builder().
                setId(0).
                setEpoch(0).
                setIncarnationId(Uuid.fromString("m6CiJvfITZeKVC6UuhlZew")).
                setListeners(Collections.singletonList(new Endpoint("INTERNAL", SecurityProtocol.PLAINTEXT, "localhost", 9090))).
                setSupportedFeatures(Collections.singletonMap("foo", VersionRange.of((short) 1, (short) 2))).
                setRack(Optional.empty()).
                setFenced(false).
                setInControlledShutdown(false).
                setDirectories(Arrays.asList(
                    Uuid.fromString("dir1G6EtuR1OTdAzFw1AFQ"),
                    Uuid.fromString("dir2gwpjTvKC7sMfcLNd8g"),
                    Uuid.fromString("dir3Ir8mQ0mMxfv93RITDA")
                )).
                build();
        assertTrue(registration.hasOnlineDir(Uuid.fromString("dir1G6EtuR1OTdAzFw1AFQ")));
        assertTrue(registration.hasOnlineDir(Uuid.fromString("dir2gwpjTvKC7sMfcLNd8g")));
        assertTrue(registration.hasOnlineDir(Uuid.fromString("dir3Ir8mQ0mMxfv93RITDA")));
        assertTrue(registration.hasOnlineDir(DirectoryId.UNASSIGNED));
        assertTrue(registration.hasOnlineDir(DirectoryId.MIGRATING));
        assertFalse(registration.hasOnlineDir(Uuid.fromString("sOwN7HH7S1maxpU1WzlzXg")));
        assertFalse(registration.hasOnlineDir(DirectoryId.LOST));
    }