BigDecimalType implements VariableType { @Override public boolean isAbleToStore(Object value) { return Optional.ofNullable(value) .map(Object::getClass) .map(BigDecimal.class::isAssignableFrom) .orElse(true); }  @Override String getTypeName(); @Override boolean isCachable(); @Override Object getValue(ValueFields valueFields); @Override void setValue(Object value, ValueFields valueFields); @Override boolean isAbleToStore(Object value);  }
@Test public void isAbleToStore_should_returnTrue_when_itsBigDecimal() { assertThat(bigDecimalType.isAbleToStore(BigDecimal.valueOf(1))).isTrue(); }
@Test public void isAbleToStore_should_returnTrue_when_itsNull() { assertThat(bigDecimalType.isAbleToStore(null)).isTrue(); }
@Test public void isAbleToStore_should_returnFalse_when_itsNotBigDecimal() { assertThat(bigDecimalType.isAbleToStore("Anything that's not bigDecimal")).isFalse(); }