RxJavaPlugins { public RxJavaErrorHandler getErrorHandler() { if (errorHandler.get() == null) { Object impl = getPluginImplementationViaProperty(RxJavaErrorHandler.class); if (impl == null) { errorHandler.compareAndSet(null, DEFAULT_ERROR_HANDLER); } else { errorHandler.compareAndSet(null, (RxJavaErrorHandler) impl); } } return errorHandler.get(); } RxJavaPlugins(); static RxJavaPlugins getInstance(); RxJavaErrorHandler getErrorHandler(); void registerErrorHandler(RxJavaErrorHandler impl); RxJavaObservableExecutionHook getObservableExecutionHook(); void registerObservableExecutionHook(RxJavaObservableExecutionHook impl); RxJavaSchedulersHook getSchedulersHook(); void registerSchedulersHook(RxJavaSchedulersHook impl);  }
@Test public void testErrorHandlerDefaultImpl() { RxJavaErrorHandler impl = new RxJavaPlugins().getErrorHandler(); assertSame(RxJavaPlugins.DEFAULT_ERROR_HANDLER, impl); }
@Test public void testErrorHandlerViaProperty() { try { RxJavaPlugins p = new RxJavaPlugins(); String fullClass = getFullClassNameForTestClass(RxJavaErrorHandlerTestImpl.class); System.setProperty("rxjava.plugin.RxJavaErrorHandler.implementation", fullClass); RxJavaErrorHandler impl = p.getErrorHandler(); assertTrue(impl instanceof RxJavaErrorHandlerTestImpl); } finally { System.clearProperty("rxjava.plugin.RxJavaErrorHandler.implementation"); } }