### Question:
Convert { public static Long toLong(Object value) { if (value == null) { return null; } else if (value instanceof Long) { return (Long) value; } else if (value instanceof Number) { return ((Number) value).longValue(); } else if (value instanceof java.util.Date) { return ((java.util.Date) value).getTime(); } else { try { return Long.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Long", e); } } } private  Convert(); static String toString(Object value); static Boolean toBoolean(Object value); static java.sql.Date toSqlDate(Object value); static java.sql.Date truncateToSqlDate(Object value); static java.sql.Date truncateToSqlDate(long time); static String toIsoString(java.util.Date date); static Double toDouble(Object value); static java.sql.Time toTime(Object value); static java.sql.Timestamp toTimestamp(Object value); static Float toFloat(Object value); static Long toLong(Object value); static Integer toInteger(Object value); static BigDecimal toBigDecimal(Object value); static byte[] toBytes(Object value); static byte[] toBytes(Blob blob); static Short toShort(Object value);  }### Answer:
@Test public void shouldCovertToLong() { Object object = Convert.toLong(1); the(object).shouldBeA(Long.class); a(object).shouldBeEqual(1); object = Convert.toLong("1"); the(object).shouldBeA(Long.class); a(object).shouldBeEqual(1); object = Convert.toLong(1d); the(object).shouldBeA(Long.class); a(object).shouldBeEqual(1); object = Convert.toLong(new BigDecimal(1)); the(object).shouldBeA(Long.class); a(object).shouldBeEqual(1); Date date = new Date(1416127392928L); object = Convert.toLong(date); the(object).shouldBeA(Long.class); a(object).shouldBeEqual(1416127392928L); }