### Question:
SelectItems implements Iterable<SelectItem> { protected boolean getBooleanValue(Object o) { return getBooleanValue(o, Boolean.FALSE); } SelectItems(Object value); @SuppressWarnings({ "rawtypes", "unchecked" }) Iterator<SelectItem> iterator();  }### Answer:
@Test public void shouldGetBooleanValue() throws Exception { new TestableSelectItems() { @Override public void test() throws Exception { assertThat(getBooleanValue("false"), is(false)); assertThat(getBooleanValue("true"), is(true)); assertThat(getBooleanValue("xxx"), is(false)); assertThat(getBooleanValue(Boolean.FALSE), is(false)); assertThat(getBooleanValue(Boolean.TRUE), is(true)); assertThat(getBooleanValue(null), is(false)); } }.test(); }
@Test public void shouldGetBooleanWithDefaultValue() throws Exception { new TestableSelectItems() { @Override public void test() throws Exception { assertThat(getBooleanValue("false", Boolean.TRUE), is(false)); assertThat(getBooleanValue("true", Boolean.FALSE), is(true)); assertThat(getBooleanValue("xxx", Boolean.TRUE), is(false)); assertThat(getBooleanValue(Boolean.FALSE, Boolean.TRUE), is(false)); assertThat(getBooleanValue(Boolean.TRUE, Boolean.FALSE), is(true)); assertThat(getBooleanValue(null, Boolean.TRUE), is(true)); assertThat(getBooleanValue(null, Boolean.FALSE), is(false)); } }.test(); }