@Test public void testSendToNoWhere() throws IOException {
    String notValidBroker = "localhost:6090";
    Properties properties = new Properties();
    properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, notValidBroker);
    properties.setProperty("request.timeout.ms", "100");
    properties.setProperty("metadata.max.age.ms", "100");
    properties.setProperty("max.block.ms", "1000");
    KafkaWritable record = new KafkaWritable(-1, -1, "value".getBytes(), null);
    SimpleKafkaWriter writer = new SimpleKafkaWriter("t", null, properties);
    Exception exception = null;
    try {
      writer.write(record);
      writer.close(false);
    } catch (IOException e) {
      exception = e;
    }
    Assert.assertNotNull("Must rethrow exception", exception);
    Assert.assertEquals("Expect sent records not matching", 1, writer.getSentRecords());
    Assert.assertEquals("Expect lost records is not matching", 1, writer.getLostRecords());
  }
Test class for Kafka simple writer.
kafka-handler/src/test/org/apache/hadoop/hive/kafka/SimpleKafkaWriterTest.java