Matomo { public static synchronized Matomo getInstance(Context context) { if (sInstance == null) { synchronized (Matomo.class) { if (sInstance == null) sInstance = new Matomo(context); } } return sInstance; } private  Matomo(Context context); static synchronized Matomo getInstance(Context context); Context getContext(); SharedPreferences getPreferences(); SharedPreferences getTrackerPreferences(@NonNull Tracker tracker); void setDispatcherFactory(DispatcherFactory dispatcherFactory); DispatcherFactory getDispatcherFactory(); static String tag(Class... classes); static String tag(String... tags); static final String LOGGER_PREFIX; }
@Test public void testNewTracker() { MatomoTestApplication app = (MatomoTestApplication) Robolectric.application; Tracker tracker = app.onCreateTrackerConfig().build(Matomo.getInstance(Robolectric.application)); assertNotNull(tracker); assertEquals(app.onCreateTrackerConfig().getApiUrl(), tracker.getAPIUrl()); assertEquals(app.onCreateTrackerConfig().getSiteId(), tracker.getSiteId()); }
@Test public void testNormalTracker() { Matomo matomo = Matomo.getInstance(Robolectric.application); Tracker tracker = new TrackerBuilder("http: assertEquals("http: assertEquals(1, tracker.getSiteId()); }