use of tec.uom.se.quantity.time.TemporalQuantity in project uom-se by unitsofmeasurement.
the class TimeQuantitiesTest method toQuantityTest.
@Test
public void toQuantityTest() {
TemporalQuantity day = TemporalQuantity.of(1, DAYS);
TemporalQuantity hour = TemporalQuantity.of(1, HOURS);
TemporalQuantity minute = TemporalQuantity.of(1, MINUTES);
TemporalQuantity second = TemporalQuantity.of(1, SECONDS);
TemporalQuantity microSecond = TemporalQuantity.of(1, MICROS);
TemporalQuantity milliSecond = TemporalQuantity.of(1, MILLIS);
TemporalQuantity nanoSecond = TemporalQuantity.of(1, NANOS);
verifyQuantity(day.toQuantity(), DAY, 1);
verifyQuantity(hour.toQuantity(), HOUR, 1);
verifyQuantity(minute.toQuantity(), MINUTE, 1);
verifyQuantity(second.toQuantity(), SECOND, 1);
verifyQuantity(microSecond.toQuantity(), TimeQuantities.MICROSECOND, 1);
verifyQuantity(milliSecond.toQuantity(), TimeQuantities.MILLISECOND, 1);
verifyQuantity(nanoSecond.toQuantity(), TimeQuantities.NANOSECOND, 1);
}
use of tec.uom.se.quantity.time.TemporalQuantity in project uom-se by unitsofmeasurement.
the class TimeQuantitiesTest method toUnitTest.
@Test
public void toUnitTest() {
TemporalQuantity day = TemporalQuantity.of(1, DAYS);
TemporalQuantity hour = TemporalQuantity.of(1, HOURS);
TemporalQuantity minute = TemporalQuantity.of(1, MINUTES);
TemporalQuantity second = TemporalQuantity.of(1, SECONDS);
TemporalQuantity microSecond = TemporalQuantity.of(1, MICROS);
TemporalQuantity milliSecond = TemporalQuantity.of(1, MILLIS);
TemporalQuantity nanoSecond = TemporalQuantity.of(1, NANOS);
Assert.assertEquals(DAY, day.toUnit());
Assert.assertEquals(HOUR, hour.toUnit());
Assert.assertEquals(MINUTE, minute.toUnit());
Assert.assertEquals(SECOND, second.toUnit());
Assert.assertEquals(TimeQuantities.MICROSECOND, microSecond.toUnit());
Assert.assertEquals(TimeQuantities.MILLISECOND, milliSecond.toUnit());
Assert.assertEquals(TimeQuantities.NANOSECOND, nanoSecond.toUnit());
}
use of tec.uom.se.quantity.time.TemporalQuantity in project uom-se by unitsofmeasurement.
the class TimeQuantitiesTest method ofTest.
@Test
public void ofTest() {
TemporalQuantity day = TemporalQuantity.of(1, DAYS);
TemporalQuantity hour = TemporalQuantity.of(1, HOURS);
TemporalQuantity minute = TemporalQuantity.of(1, MINUTES);
TemporalQuantity second = TemporalQuantity.of(1, SECONDS);
TemporalQuantity microSecond = TemporalQuantity.of(1, MICROS);
TemporalQuantity milliSecond = TemporalQuantity.of(1, MILLIS);
TemporalQuantity nanoSecond = TemporalQuantity.of(1, NANOS);
Assert.assertEquals(DAYS, day.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), day.getValue());
Assert.assertEquals(HOURS, hour.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), hour.getValue());
Assert.assertEquals(MINUTES, minute.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), minute.getValue());
Assert.assertEquals(SECONDS, second.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), second.getValue());
Assert.assertEquals(MICROS, microSecond.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), microSecond.getValue());
Assert.assertEquals(MILLIS, milliSecond.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), milliSecond.getValue());
Assert.assertEquals(NANOS, nanoSecond.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), nanoSecond.getValue());
}
use of tec.uom.se.quantity.time.TemporalQuantity in project uom-se by unitsofmeasurement.
the class TimeQuantitiesTest method ofQuantityTest.
@Test
public void ofQuantityTest() {
Quantity<Time> hour = Quantities.getQuantity(1, Units.HOUR);
TemporalQuantity timeQuantity = TemporalQuantity.of(hour);
Assert.assertEquals(SECONDS, timeQuantity.getTemporalUnit());
Assert.assertEquals(SECOND, timeQuantity.toUnit());
Assert.assertEquals(Integer.valueOf(3600), timeQuantity.getValue());
}
use of tec.uom.se.quantity.time.TemporalQuantity in project uom-se by unitsofmeasurement.
the class TimeQuantitiesTest method convertTest.
@Test
public void convertTest() {
TemporalQuantity day = TemporalQuantity.of(1, DAYS);
TemporalQuantity hours = day.to(HOURS);
Assert.assertEquals(HOURS, hours.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(24), hours.getValue());
TemporalQuantity oneDay = hours.to(DAYS);
Assert.assertEquals(DAYS, oneDay.getTemporalUnit());
Assert.assertEquals(Integer.valueOf(1), oneDay.getValue());
}
Aggregations