### Question:
Convert { public static boolean toBoolean(Object data) { if (data != null) { if (data instanceof Boolean) { return (Boolean) data; } else if (data instanceof String) { if ("T".equalsIgnoreCase(data.toString().trim())) { return Boolean.TRUE; } else if ("1".equalsIgnoreCase(data.toString().trim())) { return Boolean.TRUE; } else { return Boolean.parseBoolean(data.toString().trim()); } } else { return Boolean.TRUE; } } return Boolean.FALSE; } private  Convert(); static boolean toBoolean(Object data); static Integer toInteger(Object data); static Long toLong(Object data); static BigDecimal toBigDecimal(Object data); static BigDecimal toBigDecimal(Object data, BigDecimal defaultDecimal); static Date toDate(String dateString);  }### Answer:
@Test public void testToBoolean() { System.out.println("toBoolean"); Object data = null; boolean expResult = false; boolean result = Convert.toBoolean(data); assertEquals(expResult, result); List<String> trueStrings = Arrays.asList("T", "1", "t", "true"); List<String> falseStrings = Arrays.asList("F", "0", "f", "false"); expResult = true; for (String test : trueStrings) { result = Convert.toBoolean(test); assertEquals(expResult, result); } expResult = false; for (String test : falseStrings) { result = Convert.toBoolean(test); assertEquals(expResult, result); } }