public Set<Node> voterNodes(Stream<Integer> voterIds, ListenerName listenerName) {
        return voterIds
            .map(voterId ->
                voterNode(voterId, listenerName).orElseThrow(() ->
                    new IllegalArgumentException(
                        String.format(
                            "Unable to find endpoint for voter %d and listener %s in %s",
                            voterId,
                            listenerName,
                            voters
                        )
                    )
                )
            )
            .collect(Collectors.toSet());
    }
@Test
    void testVoterNodes() {
        VoterSet voterSet = VoterSet.fromMap(voterMap(IntStream.of(1, 2, 3), true));

        assertEquals(
            Utils.mkSet(new Node(1, "localhost", 9991), new Node(2, "localhost", 9992)),
            voterSet.voterNodes(IntStream.of(1, 2).boxed(), DEFAULT_LISTENER_NAME)
        );

        assertThrows(
            IllegalArgumentException.class,
            () -> voterSet.voterNodes(IntStream.of(1, 2).boxed(), ListenerName.normalised("MISSING"))
        );

        assertThrows(
            IllegalArgumentException.class,
            () -> voterSet.voterNodes(IntStream.of(1, 4).boxed(), DEFAULT_LISTENER_NAME)
        );
    }