BindingConvertor { public static BindingConvertor<Integer, Boolean> integer2Boolean() { return integer2Boolean; }  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 );  }
@Test public void testInteger2Boolean() throws Exception { BindingConvertor<Integer, Boolean> bc = BindingConvertor.integer2Boolean(); assertTrue( bc.sourceToTarget( 1 ) ); assertTrue( bc.sourceToTarget( Integer.MAX_VALUE ) ); assertFalse( bc.sourceToTarget( 0 ) ); assertFalse( bc.sourceToTarget( Integer.MIN_VALUE ) ); assertEquals( Integer.valueOf( 1 ), bc.targetToSource( true ) ); assertEquals( Integer.valueOf( 0 ), bc.targetToSource( false ) ); }