### Question:
Publisher { public final static EventEntry start(Name eventName, Object payload, Object context) { return eventName.publisherImpl.start(eventName, payload, context); }  final static EventEntry start(Name eventName, Object payload, Object context);  }### Answer:
@Test public void validateStartEndStatistics() throws Exception { Object dummyPayload = new JsonValue("{'test': 'some value'}"); Object dummyContext1 = "Some context value"; EventEntry measure = Publisher.start(EVENT_BASIC_TEST, dummyPayload, dummyContext1); Math.sqrt(342972); measure.end(); Thread.currentThread().sleep(100); Object totals = mbs.getAttribute(getStatisticsMBean(), "Totals"); Assert.assertTrue(totals instanceof Map); Object statisticsEntry = ((Map)totals).get(EVENT_BASIC_TEST.asString()); Assert.assertNotNull(statisticsEntry, "Expected a statistic entry for " + EVENT_BASIC_TEST + ", but is null."); System.out.println("Basic invoke statistics test entry: " + statisticsEntry); }
@Test public void performanceSmokeTest() throws Exception { int warmup = 100000; int iterations = 100000; int maxTimeToAllow = 10000; Object dummyPayload = new JsonValue("{'test': 'value'}"); Object dummyContext1 = "reconID: xyz123"; for (int i = 0; i < warmup; i++) { EventEntry measure = Publisher.start(EVENT_PERF_SMOKE_TEST, dummyPayload, dummyContext1); measure.end(); } Thread.currentThread().sleep(200); long start = System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { EventEntry measure = Publisher.start(EVENT_PERF_SMOKE_TEST, dummyPayload, dummyContext1); measure.end(); } long end = System.currentTimeMillis(); long diff = end - start; System.out.println("Smartevent " + iterations + " iterations " + "took " + diff + " milliseconds. " + "Each start/end event took approx: " + MILLISEC_FORMAT.format(diff/(double)iterations) + ". This smoke test allows max " + maxTimeToAllow + " ms "); Assert.assertTrue(diff < maxTimeToAllow, "Performance warning: " + iterations + " did not complete in the expected max " + maxTimeToAllow + " ms"); }