Rollbar { public Config config() { if (rollbar != null) { return rollbar.config(); } else { return null; } } Rollbar(Context context);  Rollbar(Context context, String accessToken, String environment, boolean registerExceptionHandler);  Rollbar(Context context, String accessToken, String environment, boolean registerExceptionHandler, boolean includeLogcat);  Rollbar(Context context, String accessToken, String environment, boolean registerExceptionHandler, boolean includeLogcat, ConfigProvider configProvider);  Rollbar(Context context, String accessToken, String environment, boolean registerExceptionHandler, boolean includeLogcat, ConfigProvider configProvider, String captureIp);  Rollbar(Context context, String accessToken, String environment, boolean registerExceptionHandler, boolean includeLogcat, ConfigProvider configProvider, String captureIp, int maxLogcatSize); static Rollbar init(Context context); static Rollbar init(Context context, String accessToken, String environment); static Rollbar init(Context context, String accessToken, String environment, boolean registerExceptionHandler); static Rollbar init(Context context, String accessToken, String environment, boolean registerExceptionHandler, boolean includeLogcat); static Rollbar init(Context context, String accessToken, String environment, boolean registerExceptionHandler, boolean includeLogcat, ConfigProvider provider); static Rollbar init(Context context, ConfigProvider provider); static boolean isInit(); static Rollbar instance(); Config config(); void setPersonData(final String id, final String username, final String email); void clearPersonData(); void setIncludeLogcat(final boolean includeLogcat); void handleUncaughtErrors(); void configure(ConfigProvider configProvider); void configure(Config config); void critical(Throwable error); void critical(Throwable error, String description); void critical(Throwable error, Map<String, Object> custom); void critical(String message); void critical(String message, Map<String, Object> custom); void critical(Throwable error, Map<String, Object> custom, String description); void error(Throwable error); void error(Throwable error, String description); void error(Throwable error, Map<String, Object> custom); void error(String message); void error(String message, Map<String, Object> custom); void error(Throwable error, Map<String, Object> custom, String description); void warning(Throwable error); void warning(Throwable error, String description); void warning(Throwable error, Map<String, Object> custom); void warning(String message); void warning(String message, Map<String, Object> custom); void warning(Throwable error, Map<String, Object> custom, String description); void info(Throwable error); void info(Throwable error, String description); void info(Throwable error, Map<String, Object> custom); void info(String message); void info(String message, Map<String, Object> custom); void info(Throwable error, Map<String, Object> custom, String description); void debug(Throwable error); void debug(Throwable error, String description); void debug(Throwable error, Map<String, Object> custom); void debug(String message); void debug(String message, Map<String, Object> custom); void debug(Throwable error, Map<String, Object> custom, String description); void log(Throwable error); void log(Throwable error, String description); void log(Throwable error, Map<String, Object> custom); void log(Throwable error, Map<String, Object> custom, Level level); void log(Throwable error, Level level); void log(Throwable error, String description, Level level); void log(Throwable error, Map<String, Object> custom, String description); void log(String message); void log(String message, Map<String, Object> custom); void log(String message, Level level); void log(String message, Map<String, Object> custom, Level level); void log(final Throwable error, final Map<String, Object> custom, final String description, final Level level); void sendJsonPayload(String json); @Deprecated static void reportException(Throwable throwable); @Deprecated static void reportException(final Throwable throwable, final String level); @Deprecated static void reportException(final Throwable throwable, final String level, final String description); @Deprecated static void reportException(final Throwable throwable, final String level, final String description, final Map<String, String> params); @Deprecated static void reportMessage(String message); @Deprecated static void reportMessage(final String message, final String level); @Deprecated static void reportMessage(final String message, final String level, final Map<String, String> params); static final String TAG; }
@Test public void shouldUseDefaultBufferedSenderAndDiskQueue() { Config config; Rollbar sut = new Rollbar(mockApplicationContext, ACCESS_TOKEN, ENVIRONMENT, true); config = sut.config(); assertThat(config.sender(), instanceOf(BufferedSender.class)); assertThat(((BufferedSender)config.sender()).queue(), instanceOf(DiskQueue.class)); assertThat(((BufferedSender)config.sender()).sender(), instanceOf(SyncSender.class)); }
@Test public void shouldUseCustomSender() { Config config; final SyncSender syncSender = new SyncSender.Builder().build(); Rollbar sut = new Rollbar(mockApplicationContext, ACCESS_TOKEN, ENVIRONMENT, true, false, new ConfigProvider() { @Override public Config provide(ConfigBuilder builder) { return builder .sender(syncSender) .build(); } }); config = sut.config(); assertThat(config.sender(), instanceOf(SyncSender.class)); }
@Test public void shouldUseDefaultNotifier() { Config config; Rollbar sut = new Rollbar(mockApplicationContext, ACCESS_TOKEN, ENVIRONMENT, true); config = sut.config(); assertEquals(config.notifier().provide().getName(), "rollbar-android"); }
@Test public void shouldUseCustomNotifier() { Config config; final String notifierVersion = "1.2.3"; final String notifierName = "custom-notifier"; Rollbar sut = new Rollbar(mockApplicationContext, ACCESS_TOKEN, ENVIRONMENT, true, false, new ConfigProvider() { @Override public Config provide(ConfigBuilder builder) { return builder .notifier(new NotifierProvider(notifierVersion, notifierName)) .build(); } }); config = sut.config(); assertEquals(config.notifier().provide().getVersion(), notifierVersion); assertEquals(config.notifier().provide().getName(), notifierName); }
@Test public void shouldUseAndroidPackageInfo() { Config config; Rollbar sut = new Rollbar(mockApplicationContext, ACCESS_TOKEN, ENVIRONMENT, true); config = sut.config(); assertEquals(config.client().provide().getTopLevelData().get("code_version"), 23); assertEquals(config.client().provide().getTopLevelData().get("name_version"), "version name"); }