### Question:
Longs { public static Long toLongOrNull(String value) { return option(value).flatMap(fromStringToPossibleLong()).getOrNull(); } private  Longs(); static Mapper<String, Long> fromStringToLong(); static Mapper<Integer, Long> fromIntegerToLong(); static Mapper<BigInteger, Long> fromBigIntegerToLong(); static Mapper<Float, Long> fromFloatToLong(); static Mapper<Double, Long> fromDoubleToLong(); static Mapper<BigDecimal, Long> fromBigDecimalToLong(); static Long toLongOrNull(String value); static Long toLongOrNull(Integer value); static Long toLongOrNull(BigInteger value); static Long toLongOrNull(Float value); static Long toLongOrNull(Double value); static Long toLongOrNull(BigDecimal value); static Mapper<String, Option<Long>> fromStringToPossibleLong();  }### Answer:
@Test public void returnsLongIfStringCanBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull("1234"), is(1234L)); }
@Test public void returnsNoneIfStringCannotBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull((String) null), is(nullValue())); }
@Test public void returnsLongIfIntegerCanBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull(1234), is(1234L)); }
@Test public void returnsNoneIfIntegerCannotBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull((Integer) null), is(nullValue())); }
@Test public void returnsLongIfBigIntegerCanBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull(new BigInteger("1234")), is(1234L)); }
@Test public void returnsNoneIfBigIntegerCannotBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull((BigInteger) null), is(nullValue())); }
@Test public void returnsLongIfFloatCanBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull(1234.56F), is(1234L)); }
@Test public void returnsNoneIfFloatCannotBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull((Float) null), is(nullValue())); }
@Test public void returnsLongIfDoubleCanBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull(1234.56D), is(1234L)); }
@Test public void returnsNoneIfDoubleCannotBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull((Double) null), is(nullValue())); }
@Test public void returnsLongIfBigDecimalCanBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull(new BigDecimal("1234.56")), is(1234L)); }
@Test public void returnsNoneIfBigDecimalCannotBeConvertedUsingToLongOrNull() { assertThat(toLongOrNull((BigDecimal) null), is(nullValue())); }