@VisibleForTesting
    public CompletableFuture<Void> getPartitionsAutoUpdateFuture() {
        return partitionsAutoUpdateFuture;
    }
@Test
    public void testOnTopicsExtended() throws Exception {
        String topicName = "test-on-topics-extended";
        ClientConfigurationData conf = new ClientConfigurationData();
        conf.setServiceUrl("pulsar://localhost:6650");
        conf.setStatsIntervalSeconds(100);
        ThreadFactory threadFactory = new DefaultThreadFactory("client-test-stats", Thread.currentThread().isDaemon());
        @Cleanup("shutdownGracefully")
        EventLoopGroup eventLoopGroup = EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), false, threadFactory);

        @Cleanup
        PulsarClientImpl clientImpl = new PulsarClientImpl(conf, eventLoopGroup);

        ProducerConfigurationData producerConfData = new ProducerConfigurationData();
        producerConfData.setMessageRoutingMode(MessageRoutingMode.CustomPartition);
        producerConfData.setCustomMessageRouter(new CustomMessageRouter());
        producerConfData.setAutoUpdatePartitionsIntervalSeconds(1, TimeUnit.MILLISECONDS);

        PartitionedProducerImpl impl = new PartitionedProducerImpl(
                clientImpl, topicName, producerConfData, 1, null, null, null);

        impl.setState(HandlerState.State.Ready);
        Thread.sleep(1000);
        CompletableFuture future = impl.getPartitionsAutoUpdateFuture();

        // When null is returned in method thenCompose we will encounter an NPE exception.
        // Because the returned value will be applied to the next stage.
        // We use future instead of null as the return value.
        assertNotNull(future);
    }