package com.zendesk.maxwell.producer; import com.zendesk.maxwell.MaxwellConfig; import com.zendesk.maxwell.MaxwellContext; import org.junit.Test; import java.util.Properties; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class MaxwellKafkaProducerWorkerTest { @Test public void constructNewWorkerWithNullTopic() { MaxwellContext context = mock(MaxwellContext.class); MaxwellConfig config = new MaxwellConfig(); when(context.getConfig()).thenReturn(config); Properties kafkaProperties = new Properties(); kafkaProperties.put("bootstrap.servers", "localhost:9092"); String kafkaTopic = null; //shouldn't throw NPE new MaxwellKafkaProducerWorker(context, kafkaProperties, kafkaTopic, null); } }