use of javax.measure.spi.ServiceProvider in project uom-se by unitsofmeasurement.
the class QuantityFunctionsGroupTest method init.
@Before
public void init() {
ServiceProvider provider = ServiceProvider.current();
timeFactory = provider.getQuantityFactory(Time.class);
minutes = timeFactory.create(BigDecimal.valueOf(15), Units.MINUTE);
hours = timeFactory.create(BigDecimal.valueOf(18), Units.HOUR);
day = timeFactory.create(BigDecimal.ONE, Units.DAY);
seconds = timeFactory.create(BigDecimal.valueOf(100), Units.SECOND);
}
use of javax.measure.spi.ServiceProvider in project uom-se by unitsofmeasurement.
the class QuantityFunctionsSortTest method init.
@Before
public void init() {
ServiceProvider provider = ServiceProvider.current();
timeFactory = provider.getQuantityFactory(Time.class);
minutes = timeFactory.create(15, Units.MINUTE);
hours = timeFactory.create(18, Units.HOUR);
day = timeFactory.create(1, Units.DAY);
seconds = timeFactory.create(100, Units.SECOND);
}
use of javax.measure.spi.ServiceProvider in project indriya by unitsofmeasurement.
the class QuantityFunctionsSortTest method init.
@BeforeEach
public void init() {
ServiceProvider provider = ServiceProvider.current();
timeFactory = provider.getQuantityFactory(Time.class);
minutes = timeFactory.create(15, Units.MINUTE);
hours = timeFactory.create(18, Units.HOUR);
day = timeFactory.create(1, Units.DAY);
seconds = timeFactory.create(100, Units.SECOND);
}
use of javax.measure.spi.ServiceProvider in project sis by apache.
the class UnitServicesTest method testGetUnitFormat.
/**
* Tests {@link UnitServices#getUnitFormat(String)}.
*/
@Test
public void testGetUnitFormat() {
final ServiceProvider provider = ServiceProvider.current();
final UnitFormat f = provider.getUnitFormatService().getUnitFormat("name");
((org.apache.sis.measure.UnitFormat) f).setLocale(Locale.US);
assertEquals("CUBIC_METRE", "cubic meter", f.format(Units.CUBIC_METRE));
}
use of javax.measure.spi.ServiceProvider in project sis by apache.
the class UnitServicesTest method testDefaultSystemOfUnits.
/**
* Tests the default system of units.
*/
@Test
public void testDefaultSystemOfUnits() {
final ServiceProvider provider = ServiceProvider.current();
Set<? extends Unit<?>> units = provider.getSystemOfUnitsService().getSystemOfUnits().getUnits();
assertTrue("METRE", units.contains(Units.METRE));
assertTrue("KILOMETRE", units.contains(Units.KILOMETRE));
assertTrue("CUBIC_METRE", units.contains(Units.CUBIC_METRE));
assertTrue("METRES_PER_SECOND", units.contains(Units.METRES_PER_SECOND));
assertTrue("KILOMETRES_PER_HOUR", units.contains(Units.KILOMETRES_PER_HOUR));
assertTrue("NAUTICAL_MILE", units.contains(Units.NAUTICAL_MILE));
assertTrue("STATUTE_MILE", units.contains(Units.STATUTE_MILE));
assertTrue("DEGREE", units.contains(Units.DEGREE));
assertTrue("RADIAN", units.contains(Units.RADIAN));
assertTrue("GRAD", units.contains(Units.GRAD));
}
Aggregations