CustomExceptionHandler implements Thread.UncaughtExceptionHandler { void start() { Thread.setDefaultUncaughtExceptionHandler(this); sendStoredExceptions(); } CustomExceptionHandler(Context context, List<CrashReportingService> crashReportingServices, boolean wifiOnly); @Override void uncaughtException(Thread thread, Throwable ex);  }
@Test public void testStart() { CustomExceptionHandler customExceptionHandler = mock(CustomExceptionHandler.class); doCallRealMethod().when(customExceptionHandler).start(); customExceptionHandler.start(); verify(customExceptionHandler).sendStoredExceptions(); assertSame(Thread.getDefaultUncaughtExceptionHandler(), customExceptionHandler); }