### Question:
ConversionUtil { public static boolean toBoolean(Object value) { if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } if (value instanceof Number) { return ((Number) value).intValue() != 0; } else { String s = String.valueOf(value); if (s.length() == 0) { return false; } try { return Integer.parseInt(s) != 0; } catch (NumberFormatException e) { } switch (Character.toUpperCase(s.charAt(0))) { case 'T': case 'Y': return true; } return false; } } private  ConversionUtil(); static int toInt(Object value); static boolean toBoolean(Object value); static String[] toStringArray(Object value); static String toString(int value);  }### Answer:
@Test public void testBooleanToBoolean() { assertTrue(ConversionUtil.toBoolean(Boolean.TRUE)); assertFalse(ConversionUtil.toBoolean(Boolean.FALSE)); }
@Test public void testNumberToBoolean() { assertTrue(ConversionUtil.toBoolean(Integer.valueOf(42))); assertFalse(ConversionUtil.toBoolean(Integer.valueOf(0))); }
@Test public void testStringToBoolean() { assertTrue(ConversionUtil.toBoolean("y")); assertTrue(ConversionUtil.toBoolean("Y")); assertTrue(ConversionUtil.toBoolean("yes")); assertTrue(ConversionUtil.toBoolean("YES")); assertTrue(ConversionUtil.toBoolean("yeah")); assertTrue(ConversionUtil.toBoolean("YEAH")); assertTrue(ConversionUtil.toBoolean("t")); assertTrue(ConversionUtil.toBoolean("T")); assertTrue(ConversionUtil.toBoolean("true")); assertTrue(ConversionUtil.toBoolean("TRUE")); assertTrue(ConversionUtil.toBoolean("42")); assertFalse(ConversionUtil.toBoolean("")); assertFalse(ConversionUtil.toBoolean("n")); assertFalse(ConversionUtil.toBoolean("no")); assertFalse(ConversionUtil.toBoolean("NO")); assertFalse(ConversionUtil.toBoolean("f")); assertFalse(ConversionUtil.toBoolean("false")); assertFalse(ConversionUtil.toBoolean("FALSE")); assertFalse(ConversionUtil.toBoolean("0")); }