HockeyApp extends ServiceImpl implements CrashReportingService { public HockeyAppService createService(){ if(hockeyAppService == null) { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("https: .build(); hockeyAppService = restAdapter.create(HockeyAppService.class); } return hockeyAppService; } HockeyApp(Context context); @Override void enable(String apiKey); @Override boolean isEnabled(); @Override ServiceType getServiceType(); void logEvent(final StoredException storedException, final Callback<Object> deleteStoredExceptionCallback); HockeyAppService createService();  }
@Test public void testCreateService() { HockeyApp hockeyApp = new HockeyApp(null); assertNull(hockeyApp.hockeyAppService); hockeyApp.createService(); assertNotNull(hockeyApp.hockeyAppService); HockeyApp.HockeyAppService service = hockeyApp.hockeyAppService; hockeyApp.createService(); assertSame(service, hockeyApp.hockeyAppService); }