### Question:
Variable { public Timestamp asTimestamp() { Timestamp ts = null; if (value != null) { if (value instanceof String) { try { ts = Timestamp.valueOf((String)value); } catch (IllegalArgumentException iae) { } } else if (value instanceof Timestamp) { ts = (Timestamp)value; } } return ts; } 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 testAsTimestamp() throws Exception { assertNull("expected null", new Variable(null).asTimestamp()); Timestamp ts = new Timestamp(new Date().getTime()); Variable var = new Variable(ts); assertEquals("wrong value", ts, var.asTimestamp()); var = new Variable(ts.toString()); assertEquals("wrong value", ts, var.asTimestamp()); assertNull("asBoolean", var.asBoolean()); assertNull("asNumber", var.asNumber()); assertNotNull("asString", var.asString()); assertNotNull("asTimestamp", var.asTimestamp()); assertEquals("asBool", false, var.asBool()); assertEquals("asDouble", Double.valueOf(Double.NaN), Double.valueOf(var.asDouble())); assertEquals("asInt", Integer.MIN_VALUE, var.asInt()); }