### Question:
ComponentRuntime extends AbstractComponentContainer { public void initializeEagerComponents(boolean isDefaultApp) { for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) { Component<?> component = entry.getKey(); Lazy<?> lazy = entry.getValue(); if (component.isAlwaysEager() || (component.isEagerInDefaultApp() && isDefaultApp)) { lazy.get(); } } eventBus.enablePublishingAndFlushPending(); } ComponentRuntime(
      Executor defaultEventExecutor,
      Iterable<ComponentRegistrar> registrars,
      Component<?>... additionalComponents); @Override @SuppressWarnings("unchecked") Provider<T> getProvider(Class<T> anInterface); @Override @SuppressWarnings("unchecked") Provider<Set<T>> setOfProvider(Class<T> anInterface); void initializeEagerComponents(boolean isDefaultApp); @VisibleForTesting @RestrictTo(Scope.TESTS) void initializeAllComponentsForTests();  }### Answer:
@Test public void container_withValidDependencyGraph_withDefaultApp_shouldInitializeEagerComponentsAndTheirDependencies() { InitTracker initTracker = new InitTracker(); ComponentRuntime runtime = new ComponentRuntime( EXECUTOR, Collections.singletonList(new ComponentRegistrarImpl(Eagerness.ALWAYS)), Component.of(initTracker, InitTracker.class)); assertThat(initTracker.isInitialized()).isFalse(); runtime.initializeEagerComponents(true); assertThat(initTracker.isInitialized()).isTrue(); }
@Test public void container_withValidDependencyGraph_withDefaultApp_shouldInitializeDefaultAppEagerComponentsAndTheirDependencies() { InitTracker initTracker = new InitTracker(); ComponentRuntime runtime = new ComponentRuntime( EXECUTOR, Collections.singletonList(new ComponentRegistrarImpl(Eagerness.DEFAULT_ONLY)), Component.of(initTracker, InitTracker.class)); assertThat(initTracker.isInitialized()).isFalse(); runtime.initializeEagerComponents(true); assertThat(initTracker.isInitialized()).isTrue(); }
@Test public void container_withValidDependencyGraph_shouldNotInitializeNonDefaultAppEagerComponents() { InitTracker initTracker = new InitTracker(); ComponentRuntime runtime = new ComponentRuntime( EXECUTOR, Collections.singletonList(new ComponentRegistrarImpl(Eagerness.DEFAULT_ONLY)), Component.of(initTracker, InitTracker.class)); assertThat(initTracker.isInitialized()).isFalse(); runtime.initializeEagerComponents(false); assertThat(initTracker.isInitialized()).isFalse(); }