public void with(MatomoApplication matomoApplication) { with(matomoApplication.getTracker()); }
public boolean safelyWith(MatomoApplication matomoApplication) { return safelyWith(matomoApplication.getTracker()); }
public void with(MatomoApplication matomoApplication) { with(matomoApplication.getTracker()); }
public boolean safelyWith(MatomoApplication matomoApplication) { return safelyWith(matomoApplication.getTracker()); }
@Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { try { int timeoutMin = Integer.valueOf(charSequence.toString().trim()); timeoutMin = Math.abs(timeoutMin); ((MatomoApplication) getApplication()).getTracker() .setSessionTimeout(timeoutMin * 60); } catch (NumberFormatException e) { ((EditText) settingsActivity.findViewById(R.id.sessionTimeoutInput)).setText("30"); Timber.d("not a number: %s", charSequence.toString()); } }
@Override public void onClick(View v) { ((MatomoApplication) getApplication()).getTracker().setDryRunTarget(((CheckBox) v).isChecked() ? Collections.synchronizedList(new ArrayList<Packet>()) : null); } });
@Override public void onClick(View v) { ((MatomoApplication) getApplication()).getTracker().setDryRunTarget(((CheckBox) v).isChecked() ? Collections.synchronizedList(new ArrayList<Packet>()) : null); } });
@Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { try { int timeoutMin = Integer.valueOf(charSequence.toString().trim()); timeoutMin = Math.abs(timeoutMin); ((MatomoApplication) getApplication()).getTracker() .setSessionTimeout(timeoutMin * 60); } catch (NumberFormatException e) { ((EditText) settingsActivity.findViewById(R.id.sessionTimeoutInput)).setText("30"); Timber.d("not a number: %s", charSequence.toString()); } }
@Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { try { int interval = Integer.valueOf(charSequence.toString().trim()); ((MatomoApplication) getApplication()).getTracker() .setDispatchInterval(interval); } catch (NumberFormatException e) { Timber.d("not a number: %s", charSequence.toString()); } }
@Override public void onClick(View v) { ((MatomoApplication) getApplication()).getTracker().setOptOut(((CheckBox) v).isChecked()); } });
@Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { try { int interval = Integer.valueOf(charSequence.toString().trim()); ((MatomoApplication) getApplication()).getTracker() .setDispatchInterval(interval); } catch (NumberFormatException e) { Timber.d("not a number: %s", charSequence.toString()); } }
@Override public void onClick(View v) { ((MatomoApplication) getApplication()).getTracker().setOptOut(((CheckBox) v).isChecked()); } });
@Test public void testApplicationGetTracker() { MatomoApplication matomoApplication = (MatomoApplication) Robolectric.application; assertEquals(matomoApplication.getTracker(), matomoApplication.getTracker()); }
@Test public void testApplicationGetTracker() { MatomoApplication matomoApplication = (MatomoApplication) Robolectric.application; assertEquals(matomoApplication.getTracker(), matomoApplication.getTracker()); }
@Before public void setup() throws PackageManager.NameNotFoundException { MockitoAnnotations.initMocks(this); when(mTracker.getMatomo()).thenReturn(mMatomo); when(mMatomo.getContext()).thenReturn(mContext); when(mContext.getPackageManager()).thenReturn(mPackageManager); when(mContext.getPackageName()).thenReturn("packageName"); when(mMatomoApplication.getTracker()).thenReturn(mTracker); PackageInfo packageInfo = new PackageInfo(); packageInfo.versionCode = 123; //noinspection WrongConstant when(mPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn(packageInfo); }
@Before public void setup() throws PackageManager.NameNotFoundException { MockitoAnnotations.initMocks(this); when(mTracker.getMatomo()).thenReturn(mMatomo); when(mMatomo.getContext()).thenReturn(mContext); when(mContext.getPackageManager()).thenReturn(mPackageManager); when(mContext.getPackageName()).thenReturn("packageName"); when(mMatomoApplication.getTracker()).thenReturn(mTracker); PackageInfo packageInfo = new PackageInfo(); packageInfo.versionCode = 123; //noinspection WrongConstant when(mPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn(packageInfo); }
@Override public void onClick(View v) { TrackHelper.track().screens(getApplication()).with(((MatomoApplication) getApplication()).getTracker()); } });
@Override public void onClick(View v) { TrackHelper.track().screens(getApplication()).with(((MatomoApplication) getApplication()).getTracker()); } });
@Test public void testBaseEvent() { track().screen("/path").with(mMatomoApplication); verify(mMatomoApplication).getTracker(); verify(mTracker).track(any(TrackMe.class)); }
@Test public void testBaseEvent() { track().screen("/path").with(mMatomoApplication); verify(mMatomoApplication).getTracker(); verify(mTracker).track(any(TrackMe.class)); }