### Question:
BigDecimalType implements Type, Serializable { @Override public Object cast(Object obj) { BigDecimal value = null; if (obj != null) { if (obj instanceof BigDecimal) { value = (BigDecimal) obj; } else if (obj instanceof Number) { if (obj instanceof Double || obj instanceof Float) { value = new BigDecimal(((Number) obj).doubleValue()); } else { value = new BigDecimal(((Number) obj).longValue()); } } else if (obj instanceof Boolean) { value = new BigDecimal(((Boolean) obj) ? 1 : 0); } else if (obj instanceof String) { try { value = new BigDecimal((String) obj); } catch (NumberFormatException e) { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; } private  BigDecimalType(); @Override String getName(); @Override boolean supportsEq(); @Override boolean supportsOrdering(); @Override JsonNode toJson(JsonNodeFactory factory, Object obj); @Override Object fromJson(JsonNode node); @Override Object cast(Object obj); @SuppressWarnings({"rawtypes", "unchecked"}) @Override int compare(Object v1, Object v2); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static final Type TYPE; static final String NAME; }### Answer:
@Test public void testCastNull() { assertNull(bigDecimalType.cast(null)); }
@Test public void testCastBigDecimal() { assertTrue(bigDecimalType.cast(BigDecimal.TEN) instanceof BigDecimal); }
@Test public void testCastDouble() { assertTrue(bigDecimalType.cast(Double.MAX_VALUE) instanceof BigDecimal); }
@Test public void testCastFloat() { assertTrue(bigDecimalType.cast(Float.MAX_VALUE) instanceof BigDecimal); }
@Test public void testCastLong() { assertTrue(bigDecimalType.cast(Long.MAX_VALUE) instanceof BigDecimal); }
@Test public void testCastBooleanTrue() { assertTrue(bigDecimalType.cast(Boolean.TRUE) instanceof BigDecimal); }
@Test public void testCastBooleanFalse() { assertTrue(bigDecimalType.cast(Boolean.FALSE) instanceof BigDecimal); }
@Test public void testCastGoodString() { assertTrue(bigDecimalType.cast(String.valueOf(BigDecimal.TEN)) instanceof BigDecimal); }
@Test(expected = Error.class) public void testCastBadString() { bigDecimalType.cast("string"); }
@Test(expected = Error.class) public void testCastOtherTest() { bigDecimalType.cast(new Object()); }