### Question:
Variable { public double asDouble() { BigDecimal bd = asNumber(); return bd != null ? bd.doubleValue() : Double.NaN; } 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 testAsDouble() throws Exception { assertEquals("NAN expected", Double.valueOf(Double.NaN), Double.valueOf(new Variable(null).asDouble())); Variable var = new Variable(new BigDecimal("1.23")); assertEquals("wrong value", Double.valueOf(1.23), Double.valueOf(var.asDouble())); var = new Variable("1.23"); assertEquals("wrong value", Double.valueOf(1.23), Double.valueOf(var.asDouble())); assertNull("asBoolean", var.asBoolean()); assertNotNull("asNumber", var.asNumber()); assertNotNull("asString", var.asString()); assertNull("asTimestamp", var.asTimestamp()); assertEquals("asBool", false, var.asBool()); assertEquals("asDouble", Double.valueOf(1.23), Double.valueOf(var.asDouble())); assertEquals("asInt", 1, var.asInt()); }