MixpanelTracker 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); mixpanelAPI.trackMap(eventName, eventDataCopy); } MixpanelTracker(MixpanelAPI mixpanelAPI); @Override void logPageView(final String name); @Override void logEvent(final Map<String, Object> eventData); @Override void setUserProperty(String key, Object value); @Override void logException(Throwable e);  }
@Test @SuppressWarnings("unchecked") public void logEvent() { this.subject.logEvent(new EventBuilder("test") .setAction("an action") .get()); verify(this.mixpanelAPI).trackMap(eq("test"), anyMap()); }