MixpanelTracker implements TrackerAdapter { @Override public void logPageView(final String name) { if (this.currentPage != null && !this.currentPage.equals(name)) { this.mixpanelAPI.track(this.currentPage); } this.currentPage = name; this.mixpanelAPI.timeEvent(this.currentPage); } 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 public void logPageView() { this.subject.logPageView("test"); verify(this.mixpanelAPI).timeEvent("test"); this.subject.logPageView("test2"); verify(this.mixpanelAPI).track("test"); verify(this.mixpanelAPI).timeEvent("test2"); }