### Question:
Variable { public Boolean asBoolean() { Boolean b = null; if (value != null) { if (value instanceof String) { String str = ((String)value).toLowerCase() + ","; if (TRUE.contains(str)) { b = Boolean.TRUE; } else if (FALSE.contains(str)) { b = Boolean.FALSE; } } else if (value instanceof Boolean) { b = (Boolean)value; } } return b; } Variable(Object theValue); Object asObject(); Boolean asBoolean(); boolean asBool(); double asDouble(); int asInt(); BigDecimal asNumber(); String asString(); Timestamp asTimestamp(); String toString();  }### Answer:
@Test public void testAsBoolean() throws Exception { assertNull("expected null value", new Variable(null).asBoolean()); Variable var = new Variable(Boolean.TRUE); assertNotNull("expected value", var.asBoolean()); assertEquals("wrong value", Boolean.TRUE, var.asBoolean()); var = new Variable("1"); assertNotNull("expected value", var.asBoolean()); assertEquals("wrong value", Boolean.TRUE, var.asBoolean()); var = new Variable("true"); assertNotNull("expected value", var.asBoolean()); assertEquals("wrong value", Boolean.TRUE, var.asBoolean()); var = new Variable("0"); assertNotNull("expected value", var.asBoolean()); assertEquals("wrong value", Boolean.FALSE, var.asBoolean()); var = new Variable(Boolean.TRUE); assertNotNull("asBoolean", var.asBoolean()); assertNull("asNumber", var.asNumber()); assertNull("asString", var.asString()); assertNull("asTimestamp", var.asTimestamp()); assertEquals("asBool", true, var.asBool()); assertEquals("asDouble", Double.valueOf(Double.NaN), Double.valueOf(var.asDouble())); assertEquals("asInt", Integer.MIN_VALUE, var.asInt()); }