@Test
public void testBadEventGoodEvent() {

  String badData1 = "hi guys! <10F> bad bad data\n";
  SyslogUtils util = new SyslogUtils(false);
  ChannelBuffer buff = ChannelBuffers.buffer(100);
  buff.writeBytes(badData1.getBytes());
  String priority = "<10>";
  String goodData1 = "Good good good data\n";
  buff.writeBytes((priority + goodData1).getBytes());
  Event e = util.extractEvent(buff);
  if (e == null) {
    throw new NullPointerException("Event is null");
  }
  Map<String, String> headers = e.getHeaders();
  Assert.assertEquals("0", headers.get(SyslogUtils.SYSLOG_FACILITY));
  Assert.assertEquals("0", headers.get(SyslogUtils.SYSLOG_SEVERITY));
  Assert.assertEquals(SyslogUtils.SyslogStatus.INVALID.getSyslogStatus(),
                      headers.get(SyslogUtils.EVENT_STATUS));
  Assert.assertEquals(badData1.trim(), new String(e.getBody()).trim());
  Event e2 = util.extractEvent(buff);
  if (e2 == null) {
    throw new NullPointerException("Event is null");
  }
  Map<String, String> headers2 = e2.getHeaders();
  Assert.assertEquals("1", headers2.get(SyslogUtils.SYSLOG_FACILITY));
  Assert.assertEquals("2", headers2.get(SyslogUtils.SYSLOG_SEVERITY));
  Assert.assertEquals(null, headers2.get(SyslogUtils.EVENT_STATUS));
  Assert.assertEquals(priority + goodData1.trim(), new String(e2.getBody()).trim());
}