BooleanValueConverter extends AbstractValueConverter<Boolean> { @Override public Boolean convert(String s) { if (TRUE.equals(s) || FALSE.equals(s)) { return Boolean.valueOf(s); } throw new IllegalArgumentException("Can't convert '" + s + "' to Boolean."); }  @Override Boolean convert(String s); @Override String toString(Boolean value); static final BooleanValueConverter INSTANCE; }
@Test public void testConvert() throws Exception { assertTrue(converter.convert("true")); assertFalse(converter.convert("false")); }
@Test(expected = IllegalArgumentException.class) public void testConvertNull() throws Exception { converter.convert(null); }
@Test(expected = IllegalArgumentException.class) public void testConvertInvalidTrue() throws Exception { converter.convert("ture"); }
@Test(expected = IllegalArgumentException.class) public void testConvertInvalidFalse() throws Exception { converter.convert("fasle"); }