### Question:
LifecycleComponentStack implements LifecycleComponent { @Override public Lifecycle.State lifecycleState() { return components.get(0).lifecycleState(); } private  LifecycleComponentStack(String name,
                                    ComponentInfoPublisher componentInfoPublisher,
                                    ImmutableList<LifecycleComponent> components); static Builder newBuilder(); @VisibleForTesting int getNumComponents(); @VisibleForTesting LifecycleComponent getComponent(int index); @Override String getName(); @Override Lifecycle.State lifecycleState(); @Override void addLifecycleListener(LifecycleListener listener); @Override void removeLifecycleListener(LifecycleListener listener); @Override void publishInfo(ComponentInfoPublisher componentInfoPublisher); @Override void start(); @Override void stop(); @Override void close(); @Override void setExceptionHandler(UncaughtExceptionHandler handler);  }### Answer:
@Test public void testLifecycleState() { LifecycleComponent component1 = mock(LifecycleComponent.class); when(component1.lifecycleState()).thenReturn(Lifecycle.State.INITIALIZED); LifecycleComponent component2 = mock(LifecycleComponent.class); when(component2.lifecycleState()).thenReturn(Lifecycle.State.STARTED); LifecycleComponentStack stack = LifecycleComponentStack.newBuilder() .withName("get-lifecycle-state") .addComponent(component1) .addComponent(component2) .build(); assertEquals(Lifecycle.State.INITIALIZED, stack.lifecycleState()); }