BooleanConverter implements Converter<String, Object, Component> { @Override public String coerceToUi(Object beanProp, Component component, BindContext ctx) { return label(beanProp, ctx); }  @Override String coerceToUi(Object beanProp, Component component, BindContext ctx); @Override Boolean coerceToBean(String compAttr, Component component, BindContext ctx);  }
@Test public void testCoerceToUi() throws Exception { BindContextMock bindContext = new BindContextMock(); assertNull(new BooleanConverter().coerceToUi(null, null, bindContext)); assertEquals("True", new BooleanConverter().coerceToUi(Boolean.TRUE, null, bindContext)); assertEquals("False", new BooleanConverter().coerceToUi(Boolean.FALSE, null, bindContext)); assertEquals("False", new BooleanConverter().coerceToUi(new Object(), null, bindContext)); bindContext.putConverterArgs("yesLabel", "Yes"); bindContext.putConverterArgs("noLabel", "No"); bindContext.putConverterArgs("nilLabel", "None"); assertEquals("Yes", new BooleanConverter().coerceToUi(Boolean.TRUE, null, bindContext)); assertEquals("No", new BooleanConverter().coerceToUi(Boolean.FALSE, null, bindContext)); assertEquals("None", new BooleanConverter().coerceToUi(null, null, bindContext)); }