final ImmutableNumberSubTypeConstraint subTypeConstraint =
CONSTRAINT_FACTORY.getNumberSubTypeConstraint(Integer.class);
numberType.setNumberSubTypeConstraint(subTypeConstraint);
quantityType.setMagnitudeType(numberType);
final MutableUnitType unitType = TYPE_FACTORY.createUnitType();
final MutableEnumeratedConstraint enumeratedConstraint =
CONSTRAINT_FACTORY.createEnumeratedConstraint();
final List enumeratedValues =
enumeratedConstraint.getMutableEnumeratedValues();
enumeratedValues.add(QuantityUnits.MILLIMETERS);
enumeratedValues.add(QuantityUnits.CENTIMETERS);
enumeratedValues.add(QuantityUnits.INCHES);
unitType.setEnumeratedConstraint(enumeratedConstraint);
quantityType.setUnitType(unitType);
// normal case
MutableQuantityValue quantityValue = VALUE_FACTORY.createQuantityValue();
final MutableNumberValue magnitudeValue =