### Question:
MessageEvent extends EventTemplate { @Override public String getDefaultDestination() { String type = ""; try { type = "." + getPayload().getStatements(MESSAGE_TYPE).get(0).getValue().toLowerCase().trim(); } catch (Exception e) { type = ""; } return "app.event.sensor.messages" + type; } MessageEvent(Object source, String message); void setType(String type); void setLevel(String level); void setExpiration(long expires); void setFrom(String from); void setTo(String to); void setAttachmentPath(String path); void setAttachmentPath(File attachment); String getFrom(); String getTo(); String getText(); String getAttachmentPath(); @Override String getDefaultDestination();  }### Answer:
@Test public void testDefaultDestination() { MessageEvent evt = new MessageEvent(null, "hello there"); assertEquals("Default destination should be 'app.event.sensor.messages.callout'", "app.event.sensor.messages.callout", evt.getDefaultDestination()); }
@Test public void testDefaultDestinationWithNull() { MessageEvent evt = new MessageEvent(null, "hello there"); evt.getPayload().clear(); assertEquals("Custom destination should work also with null", "app.event.sensor.messages", evt.getDefaultDestination()); }