@Test
    public void testRackListWithInvalidRacks() {
        MockRandom random = new MockRandom();
        RackList rackList = new RackList(random, Arrays.asList(
            new UsableBroker(11, Optional.of("1"), false),
            new UsableBroker(10, Optional.of("1"), false),
            new UsableBroker(30, Optional.of("3"), true),
            new UsableBroker(31, Optional.of("3"), true),
            new UsableBroker(20, Optional.of("2"), true),
            new UsableBroker(21, Optional.of("2"), true),
            new UsableBroker(41, Optional.of("4"), false),
            new UsableBroker(40, Optional.of("4"), true)).iterator());
        assertEquals(8, rackList.numTotalBrokers());
        assertEquals(3, rackList.numUnfencedBrokers());
        assertEquals(Arrays.asList(Optional.of("1"),
            Optional.of("2"),
            Optional.of("3"),
            Optional.of("4")), rackList.rackNames());
        assertEquals(Arrays.asList(41, 11, 21, 30), rackList.place(4));
        assertEquals(Arrays.asList(10, 20, 31, 41), rackList.place(4));
        assertEquals(Arrays.asList(41, 21, 30, 11), rackList.place(4));
    }
Test that we will place on the fenced replica if we need to.
metadata/src/test/java/org/apache/kafka/metadata/placement/StripedReplicaPlacerTest.java