### Question:
Variable { public int asInt() { BigDecimal bd = asNumber(); return bd != null ? bd.intValue() : Integer.MIN_VALUE; } 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 testAsInt() throws Exception { assertEquals("Integer.MIN_VALUE expected", Integer.MIN_VALUE, new Variable(null).asInt()); Variable var = new Variable(new BigDecimal("3")); assertEquals("wrong value", 3, var.asInt()); var = new Variable("3"); assertEquals("wrong value", 3, var.asInt()); 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(3.00), Double.valueOf(var.asDouble())); assertEquals("asInt", 3, var.asInt()); }