### Question:
DefaultComponentInfo implements ComponentInfo { public String getFor() { UIComponent component = getComponent(); return (component == null ? null : component.getClientId()); } DefaultComponentInfo(FacesContext context, List<UIComponent> components); UIComponent getComponent(); List<UIComponent> getComponents(); boolean isValid(); boolean isRequired(); String getLabel(); String getFor();  }### Answer:
@Test public void shouldGetNullForIfNoComponents() throws Exception { ComponentInfo info = new DefaultComponentInfo(this.context, NO_COMPONENTS); assertThat(info.getFor(), is(nullValue())); }
@Test public void shouldGetForFromComponentClientID() throws Exception { List<UIComponent> components = createComponents(2); given(components.get(0).getClientId()).willReturn("id1"); given(components.get(1).getClientId()).willReturn("id2"); ComponentInfo info = new DefaultComponentInfo(this.context, components); assertThat(info.getFor(), is("id1")); }