TypeUtils { public static boolean isFalse(Object o) { if (o == null) return false; if (o instanceof Boolean) return !(Boolean) o; return "false".equalsIgnoreCase(o.toString()); }  static List<T> asList(T[] a); static Class<?> fromName(String name); static String toName(Class<?> type); static Object valueOf(Class<?> type, String value); static Object valueOf(String type, String value); static int parseInt(String s, int offset, int length, int base); static int parseInt(byte[] b, int offset, int length, int base); static byte[] parseBytes(String s, int base); static String toString(byte[] bytes, int base); static byte convertHexDigit(byte c); static int convertHexDigit(char c); static int convertHexDigit(int c); static void toHex(byte b, Appendable buf); static void toHex(int value, Appendable buf); static void toHex(long value, Appendable buf); static String toHexString(byte b); static String toHexString(byte[] b); static String toHexString(byte[] b, int offset, int length); static byte[] fromHexString(String s); static void dump(Class<?> c); static void dump(ClassLoader cl); static boolean isTrue(Object o); static boolean isFalse(Object o); static final Class<?>[] NO_ARGS; static final int CR; static final int LF; }
@Test void testIsFalse() { assertTrue(TypeUtils.isFalse(Boolean.FALSE)); assertTrue(TypeUtils.isFalse(false)); assertTrue(TypeUtils.isFalse("false")); assertTrue(TypeUtils.isFalse(new Object() { @Override public String toString() { return "false"; } })); assertFalse(TypeUtils.isFalse(Boolean.TRUE)); assertFalse(TypeUtils.isFalse(true)); assertFalse(TypeUtils.isFalse("true")); assertFalse(TypeUtils.isFalse("blargle")); assertFalse(TypeUtils.isFalse(new Object() { @Override public String toString() { return "true"; } })); }