BigDecimalType implements VariableType { @Override public Object getValue(ValueFields valueFields) { return Optional.ofNullable(valueFields) .map(ValueFields::getTextValue) .map(BigDecimal::new) .orElse(null); }  @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 getValue_should_convertTextValueToBigDecimal() { ValueFields valueFields = new VariableInstanceEntityImpl(); valueFields.setTextValue("0.1000"); Object convertedValue = bigDecimalType.getValue(valueFields); assertThat(convertedValue).isEqualTo(BigDecimal.valueOf(1000, 4)); }
@Test public void getValue_should_convertNullValue() { ValueFields valueFields = new VariableInstanceEntityImpl(); valueFields.setTextValue(null); Object convertedValue = bigDecimalType.getValue(valueFields); assertThat(convertedValue).isNull(); }