@Test public void testGetNullValues() { final Event testEvent = Event.create("type").value("key1", "val1").build(); assertTrue(testEvent.getValue("key1").isPresent()); assertFalse(testEvent.getValue("key2").isPresent()); }
@Test public void testDataValues() { final Event testEvent = Event.create("type") .distributed(true) .value("int1", 1) .value("long1", 10L) .value("bool1", false) .value("obj1", this.createTestEvent()) .build(); assertTrue(testEvent.hasValue("int1")); assertTrue(testEvent.hasValue("long1")); assertTrue(testEvent.hasValue("bool1")); assertTrue(testEvent.hasValue("obj1")); assertTrue(testEvent.getValue("int1").get() instanceof Integer); assertTrue(testEvent.getValue("long1").get() instanceof Long); assertTrue(testEvent.getValue("bool1").get() instanceof Boolean); assertTrue(testEvent.getValue("obj1").get() instanceof String); }
@Test public void testBuilder() { final Event event = this.createTestEvent(); assertEquals("type", event.getType()); assertEquals(true, event.isDistributed()); assertNotNull(event.getData()); assertTrue(event.hasValue("key1")); assertTrue(event.hasValue("key2")); assertEquals("val1", event.getValue("key1").get()); assertEquals("val2", event.getValue("key2").get()); }