Search in sources :

Example 16 with UnitFormat

use of javax.measure.format.UnitFormat in project uom-se by unitsofmeasurement.

the class LocalFormatTest method testParseIrregularStringLocal.

@Test(expected = UnsupportedOperationException.class)
public void testParseIrregularStringLocal() {
    final UnitFormat format = LocalUnitFormat.getInstance();
    Unit<?> u = format.parse("bl//^--1a");
// System.out.println(u);
}
Also used : UnitFormat(javax.measure.format.UnitFormat) Test(org.junit.Test)

Example 17 with UnitFormat

use of javax.measure.format.UnitFormat in project uom-se by unitsofmeasurement.

the class LocalFormatTest method testPrefixKm.

@Test
@Ignore
public // TODO LocalUnitFormat won't parse Compound Units, EBNF does, also see https://github.com/unitsofmeasurement/uom-se/issues/145
void testPrefixKm() {
    final UnitFormat format = LocalUnitFormat.getInstance();
    Unit<?> u = format.parse("km");
    assertEquals(KILO(METRE), u);
    assertEquals("km", u.toString());
}
Also used : UnitFormat(javax.measure.format.UnitFormat) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

UnitFormat (javax.measure.format.UnitFormat)17 Test (org.junit.Test)8 Test (org.junit.jupiter.api.Test)8 LocalUnitFormat (tech.units.indriya.format.LocalUnitFormat)7 SimpleUnitFormat (tech.units.indriya.format.SimpleUnitFormat)3 IOException (java.io.IOException)2 Unit (javax.measure.Unit)2 ParserException (javax.measure.format.ParserException)2 Speed (javax.measure.quantity.Speed)2 Locale (java.util.Locale)1 ServiceProvider (javax.measure.spi.ServiceProvider)1 Ignore (org.junit.Ignore)1 Disabled (org.junit.jupiter.api.Disabled)1