BindingConvertor { public static BindingConvertor<Boolean, String> boolean2String() { return boolean2String; }  abstract R sourceToTarget( V value ); abstract V targetToSource( R value ); static BindingConvertor<Collection, Object[]> collection2ObjectArray(); static BindingConvertor<Integer, String> integer2String(); static BindingConvertor<Integer, Boolean> integer2Boolean(); static BindingConvertor<String, Integer> string2Integer(); static BindingConvertor<Long, String> long2String(); static BindingConvertor<Date, String> date2String(); static BindingConvertor<Date, String> date2String( final DateFormat format ); static BindingConvertor<String, String> string2String(); static BindingConvertor<Boolean, String> boolean2String(); static BindingConvertor<Double, String> double2String(); static BindingConvertor<String, Double> string2Double(); static BindingConvertor<Object, Boolean> object2Boolean(); static BindingConvertor<String, String> truncatedString( int length );  }
@SuppressWarnings( "nls" ) @Test public void testBoolean2String() throws Exception { BindingConvertor<Boolean, String> bc = BindingConvertor.boolean2String(); assertEquals( "true", bc.sourceToTarget( true ) ); assertEquals( "false", bc.sourceToTarget( false ) ); assertTrue( bc.targetToSource( "true" ) ); assertFalse( bc.targetToSource( "false" ) ); assertFalse( bc.targetToSource( null ) ); assertFalse( bc.targetToSource( "anything" ) ); }