IntercomTracker implements TrackerAdapter { @Override public void logEvent(final Map<String, Object> eventData) { final Map<String, Object> eventDataCopy = new HashMap<>(eventData); String eventName = (String) eventDataCopy.get(Constants.EVENT_NAME); eventDataCopy.remove(Constants.EVENT_NAME); this.client.logEvent(eventName, eventDataCopy); } IntercomTracker(Intercom client); @Override void logPageView(String name); @Override void logEvent(final Map<String, Object> eventData); @Override void setUserProperty(String key, Object value); @Override void logException(Throwable e);  }
@SuppressWarnings("unchecked") @Test public void testLogEvent() { HashMap<String, Object> eventValue = new HashMap<>(); eventValue.put(EVENT_NAME, "testName"); eventValue.put(EVENT_CATEGORY, "testCategory"); this.subject.logEvent(eventValue); verify(this.tracker).logEvent(eq("testName"), anyMap()); }