/** * Send an exception event out for aggregation/analysis * * @param description API limited to 100 characters, truncated here to 100 if needed * @param fatal whether it was fatal or not */ @SuppressWarnings("WeakerAccess") public static void sendAnalyticsException(@NonNull String description, boolean fatal) { Timber.d("sendAnalyticsException() description/fatal: %s/%s", description, fatal); if (!sOptIn) { return; } sAnalytics.exception().exceptionDescription(description).exceptionFatal(fatal).sendAsync(); } }
ExceptionHit spyHit = Mockito.spy(new ExceptionHit()); Mockito.doReturn(spyHit).when(mAnalytics).exception(); Mockito.verify(childException).getCause(); Mockito.verify(mAnalytics).exception(); Mockito.verify(spyHit).exceptionDescription(ArgumentMatchers.anyString()); Mockito.verify(spyHit).sendAsync(); Assert.assertEquals(spyHit.exceptionDescription(), "child exception toString()");
public ExceptionHit(String exceptionDescription, Boolean fatal) { super(HIT_EXCEPTION); exceptionDescription(exceptionDescription); exceptionFatal(fatal); }
@Override public ExceptionHit exception() { return (ExceptionHit) new ExceptionHit().setExecutor(this); }
public Boolean exceptionFatal() { return getBoolean(EXCEPTION_FATAL); } }
public String exceptionDescription() { return getString(EXCEPTION_DESCRIPTION); }
setBoolean(EXCEPTION_FATAL, value); return this;
setString(EXCEPTION_DESCRIPTION, value); return this;
public ExceptionHit(String exceptionDescription, Boolean fatal) { super(HIT_EXCEPTION); exceptionDescription(exceptionDescription); exceptionFatal(fatal); }
@Override public ExceptionHit exception() { return (ExceptionHit) new ExceptionHit().setExecutor(this); }
public Boolean exceptionFatal() { return getBoolean(EXCEPTION_FATAL); } }
public String exceptionDescription() { return getString(EXCEPTION_DESCRIPTION); }
setBoolean(EXCEPTION_FATAL, value); return this;
setString(EXCEPTION_DESCRIPTION, value); return this;