@Override
    public <T> void write(T payload) {
        if (payload == null) {
            LOG.debug("Payload was null. Skipping.");
            return;
        }

        String canonicalClassName = AutoValueUtils.getCanonicalName(payload.getClass());
        write(canonicalClassName, payload);
    }
@Test
    public void writePostsClusterConfigChangedEvent() throws Exception {
        CustomConfig customConfig = new CustomConfig();
        customConfig.text = "TEST";

        final ClusterConfigChangedEventHandler eventHandler = new ClusterConfigChangedEventHandler();
        clusterEventBus.registerClusterEventSubscriber(eventHandler);

        @SuppressWarnings("deprecation")
        final DBCollection collection = mongoConnection.getDatabase().getCollection(COLLECTION_NAME);
        assertThat(collection.count()).isEqualTo(0L);

        clusterConfigService.write(customConfig);

        assertThat(collection.count()).isEqualTo(1L);
        assertThat(eventHandler.event).isNotNull();
        assertThat(eventHandler.event.nodeId()).isEqualTo("ID");
        assertThat(eventHandler.event.type()).isEqualTo(CustomConfig.class.getCanonicalName());

        clusterEventBus.unregister(eventHandler);
    }