public static BigDecimal cast(final Integer value, final int precision, final int scale) {
    if (value == null) {
      return null;
    }

    return cast(value.longValue(), precision, scale);
  }
@Test
  public void shouldNotCastDecimalTooNegative() {
    // When:
    final Exception e = assertThrows(
        ArithmeticException.class,
        () -> cast(new BigDecimal(-10), 2, 1)
    );

    // Then:
    assertThat(e.getMessage(), containsString("Numeric field overflow"));
  }