### Question:
DefaultComponentInfo implements ComponentInfo { public UIComponent getComponent() { if (this.components.isEmpty()) { return null; } return this.components.get(0); } DefaultComponentInfo(FacesContext context, List<UIComponent> components); UIComponent getComponent(); List<UIComponent> getComponents(); boolean isValid(); boolean isRequired(); String getLabel(); String getFor();  }### Answer:
@Test public void shouldGetNullComponentIfHasNone() throws Exception { ComponentInfo info = new DefaultComponentInfo(this.context, NO_COMPONENTS); assertThat(info.getComponent(), is(nullValue())); }
@Test public void shouldGetFirstComponent() throws Exception { List<UIComponent> components = createComponents(3); ComponentInfo info = new DefaultComponentInfo(this.context, components); assertThat(info.getComponent(), is(components.get(0))); }