@Override
    public synchronized CompletableFuture<Void> addConsumer(Consumer consumer) {
        return validateKeySharedMeta(consumer).thenRun(() -> {
            try {
                internalAddConsumer(consumer);
            } catch (BrokerServiceException.ConsumerAssignException e) {
                throw FutureUtil.wrapToCompletionException(e);
            }
        });
    }
@Test
    public void testEmptyRanges() {
        HashRangeExclusiveStickyKeyConsumerSelector selector = new HashRangeExclusiveStickyKeyConsumerSelector(10);
        Consumer consumer = mock(Consumer.class);
        KeySharedMeta keySharedMeta = new KeySharedMeta()
                .setKeySharedMode(KeySharedMode.STICKY);
        when(consumer.getKeySharedMeta()).thenReturn(keySharedMeta);
        try {
            selector.addConsumer(consumer).get();
            Assert.fail("Should have failed");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch (ExecutionException e) {
            Assert.assertTrue(e.getCause() instanceof BrokerServiceException.ConsumerAssignException);
        }
    }