BigDecimalType implements VariableType { @Override public void setValue(Object value, ValueFields valueFields) { String textValue = Optional.ofNullable(value) .map(Object::toString) .orElse(null); valueFields.setTextValue(textValue); }  @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 setValue_should_setTextValueWithStringRepresentationOfBigDecimal() { ValueFields valueFields = new VariableInstanceEntityImpl(); bigDecimalType.setValue(BigDecimal.valueOf(1000,4), valueFields); assertThat(valueFields.getTextValue()).isEqualTo("0.1000"); }
@Test public void setValue_should_setNullValue() { ValueFields valueFields = new VariableInstanceEntityImpl(); valueFields.setTextValue("someValue"); bigDecimalType.setValue(null, valueFields); assertThat(valueFields.getTextValue()).isNull(); }