use of javax.measure.quantity.Mass in project uom-se by unitsofmeasurement.
the class MeasurementTest method testOf.
@Test
public void testOf() {
Instant instant = Instant.now();
Measurement<Mass> measurement = Measurement.of(Quantities.getQuantity(15, KILOGRAM), instant);
assertEquals(Quantities.getQuantity(15, KILOGRAM), measurement.getQuantity());
assertEquals(instant, measurement.getInstant());
assertEquals(instant.toEpochMilli(), measurement.getTimestamp());
}
use of javax.measure.quantity.Mass in project indriya by unitsofmeasurement.
the class MeasurementTest method testOf.
@Test
public void testOf() {
Instant instant = Instant.now();
Measurement<Mass> measurement = Measurement.of(Quantities.getQuantity(15, KILOGRAM), instant);
assertEquals(Quantities.getQuantity(15, KILOGRAM), measurement.getQuantity());
assertEquals(instant, measurement.getInstant());
assertEquals(instant.toEpochMilli(), measurement.getTimestamp());
}
use of javax.measure.quantity.Mass in project indriya by unitsofmeasurement.
the class PrefixTest method testNestedOperationsShouldBeSame.
@Test
@Disabled("This is research for https://github.com/unitsofmeasurement/uom-se/issues/164")
public void testNestedOperationsShouldBeSame() {
Unit<Mass> m1 = MICRO(GRAM);
Unit<Mass> m2 = GRAM.divide(1000).divide(1000);
UnitConverter c1 = m1.getConverterTo(m2);
List steps1 = c1.getConversionSteps();
UnitConverter c2 = m2.getConverterTo(m1);
List steps2 = c2.getConversionSteps();
assertEquals(c1, c2);
assertEquals(m1, m2);
}
use of javax.measure.quantity.Mass in project indriya by unitsofmeasurement.
the class PrefixTest method testNestedOperationsNotTheSame.
@Test
public void testNestedOperationsNotTheSame() {
Unit<Mass> m1 = MICRO(GRAM);
Unit<Mass> m2 = GRAM.divide(1000).divide(2000);
UnitConverter c1 = m1.getConverterTo(m2);
List steps1 = c1.getConversionSteps();
UnitConverter c2 = m2.getConverterTo(m1);
List steps2 = c2.getConversionSteps();
assertNotEquals(c1, c2);
assertNotEquals(m1, m2);
}
use of javax.measure.quantity.Mass in project uom-se by unitsofmeasurement.
the class PrefixTest method testNestedOperationsShouldBeSame.
@Test
@Ignore("This is research for https://github.com/unitsofmeasurement/uom-se/issues/164")
public void testNestedOperationsShouldBeSame() {
Unit<Mass> m1 = MICRO(GRAM);
Unit<Mass> m2 = GRAM.divide(1000).divide(1000);
UnitConverter c1 = m1.getConverterTo(m2);
List steps1 = c1.getConversionSteps();
UnitConverter c2 = m2.getConverterTo(m1);
List steps2 = c2.getConversionSteps();
assertEquals(c1, c2);
assertEquals(m1, m2);
}