Search in sources :

Example 6 with TemporalQuantity

use of tech.units.indriya.quantity.time.TemporalQuantity in project indriya by unitsofmeasurement.

the class TimeQuantitiesTest method ofQuantityTest.

@Test
public void ofQuantityTest() {
    Quantity<Time> hour = Quantities.getQuantity(1, Units.HOUR);
    TemporalQuantity timeQuantity = TemporalQuantity.of(hour);
    assertEquals(SECONDS, timeQuantity.getTemporalUnit());
    assertEquals(SECOND, timeQuantity.toUnit());
    assertEquals(Integer.valueOf(3600), timeQuantity.getValue());
}
Also used : LocalTime(java.time.LocalTime) Time(javax.measure.quantity.Time) TemporalQuantity(tech.units.indriya.quantity.time.TemporalQuantity) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 TemporalQuantity (tech.units.indriya.quantity.time.TemporalQuantity)6 LocalTime (java.time.LocalTime)1 Frequency (javax.measure.quantity.Frequency)1 Time (javax.measure.quantity.Time)1