PropertyConverter { public static BigInteger toBigInteger(Object value) throws ConversionException { Number n = toNumber(value, BigInteger.class); if (n instanceof BigInteger) { return (BigInteger) n; } else { return BigInteger.valueOf(n.longValue()); } } private  PropertyConverter(); static Boolean toBoolean(Object value); static Integer toInteger(Object value); static Long toLong(Object value); static BigInteger toBigInteger(Object value); static List<String> toList(Object value); static Set<String> toSet(Object value);  }
@Test public void testToBigInteger() { assertEquals(new BigInteger("1") , toBigInteger("1")); assertEquals(new BigInteger("1") , toBigInteger(1)); assertEquals(new BigInteger("255"), toBigInteger("0xFF")); assertEquals(new BigInteger("1"), toBigInteger("0b1")); }
@Test public void testFailToBigInteger() { Throwable t = assertThrows(ConversionException.class, () -> toBigInteger(BAD_COMPARISON)); assertEquals(expectedMessage(BAD_COMPARISON, BigInteger.class), t.getMessage()); }