Closed fillumina closed 1 year ago
Looks like a duplicate of #384
It is not directly related to #384, but we won't fix this, because MetricPrefix.KILO(GRAM)
becomes "1000 g" and that as you correctly asserted is a different unit, similar for the Number type of the value, because if you parse Quantity<Mass> w2 = (Quantity<Mass>) Quantities.getQuantity("12.5 kg");
with locales like GERMAN, etc. (or probably ITALIAN in your case) "12.5" also turns into 125, an Integer
unlike the Double
value of 12.5.
// uses BasicUnit
Quantity<Mass> w1 = Quantities.getQuantity(12.5, KILOGRAM);
// uses BasicUnit
Quantity<Mass> w2 = (Quantity<Mass>) Quantities.getQuantity("12,5 kg");
are equal, for the other way of constructing quantities please compare them with isEquivalentTo()
.
The following test defines two quantities that should be equals but because they are using a different Unit class they are not. I think this impacts the usability of the library. Regards.