Event { public Event(String eventType, String message) { this(eventType, message, Maps.<String, Object>newHashMap()); } Event(String eventType, String message);  Event(String eventType, String message, Map<String, Object> metadata); String getId(); Timestamp getTimestamp(); String getEventType(); String getMessage(); String getNotifier(); Map<String, Object> getMetadata(); T getMetadataItem(String key); @Override String toString();  }
@Test public void testEvent() { Map<String, Object> metadata = Maps.newHashMap(); metadata.put("metadata.key", "hello"); Event event = new Event("event.type", "message", metadata); assertTrue(event.getId().length() > 0); assertEquals("event.type", event.getEventType()); assertEquals("message", event.getMessage()); assertEquals(metadata, event.getMetadata()); assertEquals("hello", event.getMetadataItem("metadata.key")); assertEquals(this.getClass().getName(), event.getNotifier()); assertNotNull(event.getTimestamp()); }