ResultSetUtil { public static Object convertBigDecimalValue(final Object value, final boolean needScale, final int scale) { if (null == value) { return convertNullValue(BigDecimal.class); } if (value.getClass() == BigDecimal.class) { return adjustBigDecimalResult((BigDecimal) value, needScale, scale); } if (value instanceof Number || value instanceof String) { BigDecimal bigDecimal = new BigDecimal(value.toString()); return adjustBigDecimalResult(bigDecimal, needScale, scale); } throw new ShardingSphereException("Unsupported Date type: BigDecimal for value %s", value); }  static Object convertValue(final Object value, final Class<?> convertType); static Object convertBigDecimalValue(final Object value, final boolean needScale, final int scale);  }
@Test public void assertConvertBigDecimalValue() { BigDecimal bigDecimal = (BigDecimal) ResultSetUtil.convertBigDecimalValue("12", false, 0); assertThat(bigDecimal, is(BigDecimal.valueOf(12))); }
@Test public void assertConvertBigDecimalValueNull() { BigDecimal bigDecimal = (BigDecimal) ResultSetUtil.convertBigDecimalValue(null, false, 0); assertNull(bigDecimal); }
@Test public void assertConvertBigDecimalValueWithScale() { BigDecimal bigDecimal = (BigDecimal) ResultSetUtil.convertBigDecimalValue("12.243", true, 2); assertThat(bigDecimal, is(BigDecimal.valueOf(12.24))); }
@Test(expected = ShardingSphereException.class) public void assertConvertBigDecimalValueError() { ResultSetUtil.convertBigDecimalValue(new Date(), true, 2); }