@Test public void testInstallDefaultEventBus() { EventBusBuilder builder = EventBus.builder(); try { // Either this should throw when another unit test got the default event bus... eventBus = builder.installDefaultEventBus(); Assert.assertEquals(eventBus, EventBus.getDefault()); // ...or this should throw eventBus = builder.installDefaultEventBus(); fail("Should have thrown"); } catch (EventBusException e) { // Expected } }
@Test public void testInstallDefaultEventBus() { EventBusBuilder builder = EventBus.builder(); try { // Either this should throw when another unit test got the default event bus... eventBus = builder.installDefaultEventBus(); Assert.assertEquals(eventBus, EventBus.getDefault()); // ...or this should throw eventBus = builder.installDefaultEventBus(); fail("Should have thrown"); } catch (EventBusException e) { // Expected } }
@Override public void onCreate() { super.onCreate(); EventBus.builder().addIndex(new MyEventBusIndex()).installDefaultEventBus(); Intent serviceIntent = new Intent(getApplicationContext(), MasterBrainService.class); startService(serviceIntent); AndroidGraphicFactory.createInstance(this); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); final float fs = Float.valueOf(preferences.getString(SETTING_SCALE, Float.toString(DisplayModel.getDefaultUserScaleFactor()))); if (fs != DisplayModel.getDefaultUserScaleFactor()) { DisplayModel.setDefaultUserScaleFactor(fs); } } }
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); Utils.migrateTray2SharedPreferences(this); ACRA.init(this); EventBus.builder().logNoSubscriberMessages(false).installDefaultEventBus(); } }
@Override public void onCreate() { super.onCreate(); if(BuildConfig.DEBUG) Stetho.initializeWithDefaults(this); EventBus.builder() .sendNoSubscriberEvent(false) .sendSubscriberExceptionEvent(false) .throwSubscriberException(BuildConfig.DEBUG) .addIndex(new EventBusIndex()) .installDefaultEventBus(); Settings.init(this); settings = new Settings(this); settings.initPreferences(); new EventProcessor(this).start(); DbConnection.setContext(this); instance = this; }