Mixpanel extends ServiceImpl implements EventTrackingService { protected MixpanelService createService(){ if(mixpanelService == null) { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("https: .build(); mixpanelService = restAdapter.create(MixpanelService.class); } return mixpanelService; } Mixpanel(Context context); @Override void enable(String projectToken); @Override boolean isEnabled(); @Override ServiceType getServiceType(); @Override void logEvent(Context context, String eventName);  }
@Test public void testCreateService() { Mixpanel mixpanel = new Mixpanel(null); assertNull(mixpanel.mixpanelService); mixpanel.createService(); assertNotNull(mixpanel.mixpanelService); Mixpanel.MixpanelService service = mixpanel.mixpanelService; mixpanel.createService(); assertSame(service, mixpanel.mixpanelService); }