DataUtil { public static boolean getBoolean(Object value, boolean defValue) { return doGetBoolean(value, defValue); }  static boolean getBoolean(Object value, boolean defValue); static Boolean doGetBoolean(Object value, Boolean defValue); static boolean toBoolean(String value, boolean defValue); static Boolean convertToBoolean(String value, Boolean defValue); static boolean toBoolean(String value); static int getInt(Object value, int defValue); static long getLong(Object value, long defValue); static double getDouble(Object value, double defValue); static String getString(Object value, String defValue); static String[] getStringArray(Object object, String[] defValue); static int[] getIntArray(Object object, int[] defValue); static List<String> getStringList(Object object);  }
@Test public void getBoolean() throws Exception { new DataUtil(); assertEquals(DataUtil.getBoolean(null, true), true); assertEquals(DataUtil.getBoolean(Boolean.TRUE, false), true); assertEquals(DataUtil.getBoolean(Boolean.TRUE, false), true); assertEquals(DataUtil.getBoolean("True", false), true); assertEquals(DataUtil.getBoolean("T", false), true); assertEquals(DataUtil.getBoolean("F", true), false); assertEquals(DataUtil.getBoolean("DDDDD", true), true); assertEquals(DataUtil.getBoolean("DDDDD", false), false); assertEquals(DataUtil.getBoolean(1, false), true); assertEquals(DataUtil.getBoolean(0, false), false); assertEquals(DataUtil.getBoolean(new Object(), false), false); assertEquals(DataUtil.getBoolean(new Object(), true), true); }