From f4fc74fb14da11809a78cf74e7faf73af45e6d9b Mon Sep 17 00:00:00 2001 From: Werner Keil Date: Wed, 4 Nov 2020 03:25:40 +0100 Subject: [PATCH] # WARNING: head commit changed in the meantime 98: Update JUnit Task-Url: https://github.com/unitsofmeasurement/uom-demos/issues/98 --- .../systems/uom/ucum/spi/UCUMServiceProvider.java | 11 ++--------- .../systems/uom/ucum/format/UCUMFormat135Test.java | 4 ++-- .../uom/ucum/format/UnitFormatServiceTest.java | 12 ++++++------ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/ucum/src/main/java/systems/uom/ucum/spi/UCUMServiceProvider.java b/ucum/src/main/java/systems/uom/ucum/spi/UCUMServiceProvider.java index 6caa4b21..16db11a3 100644 --- a/ucum/src/main/java/systems/uom/ucum/spi/UCUMServiceProvider.java +++ b/ucum/src/main/java/systems/uom/ucum/spi/UCUMServiceProvider.java @@ -32,15 +32,13 @@ import javax.measure.spi.FormatService; import javax.measure.spi.ServiceProvider; import javax.measure.spi.SystemOfUnitsService; -import javax.measure.spi.UnitFormatService; - import tech.units.indriya.spi.AbstractServiceProvider; /** * This class implements the {@link ServiceProvider} interface and hereby uses the JDK {@link java.util.ServiceLoader} to load the services required. * * @author Werner Keil - * @version 1.0 + * @version 2.0 */ public final class UCUMServiceProvider extends AbstractServiceProvider { @@ -52,12 +50,7 @@ public int getPriority() { public SystemOfUnitsService getSystemOfUnitsService() { return new UCUMSystemService(); } - - @Override - public UnitFormatService getUnitFormatService() { - return new UCUMFormatService(); - } - + @Override public FormatService getFormatService() { return new UCUMFormatService(); diff --git a/ucum/src/test/java/systems/uom/ucum/format/UCUMFormat135Test.java b/ucum/src/test/java/systems/uom/ucum/format/UCUMFormat135Test.java index 17c4d6b1..9f6051bc 100644 --- a/ucum/src/test/java/systems/uom/ucum/format/UCUMFormat135Test.java +++ b/ucum/src/test/java/systems/uom/ucum/format/UCUMFormat135Test.java @@ -44,14 +44,14 @@ public class UCUMFormat135Test extends UCUMFormatTestBase { @Test public void testParseUCUMCSM3PerSecond() { - final UnitFormat unitFormat = ServiceProvider.current().getUnitFormatService().getUnitFormat("CI"); + final UnitFormat unitFormat = ServiceProvider.current().getFormatService().getUnitFormat("CI"); final Unit dst = unitFormat.parse("m3/s"); assertEquals("m3/s",FORMAT_CS.format(dst)); } @Test public void testParseUCUMCSComplexDenominator() { - final UnitFormat unitFormat = ServiceProvider.current().getUnitFormatService().getUnitFormat("CI"); + final UnitFormat unitFormat = ServiceProvider.current().getFormatService().getUnitFormat("CI"); final Unit dst = unitFormat.parse("m/(bar.s)"); assertEquals("m/(bar.s)",FORMAT_CS.format(dst)); } diff --git a/ucum/src/test/java/systems/uom/ucum/format/UnitFormatServiceTest.java b/ucum/src/test/java/systems/uom/ucum/format/UnitFormatServiceTest.java index cfe97da8..ff3f4777 100644 --- a/ucum/src/test/java/systems/uom/ucum/format/UnitFormatServiceTest.java +++ b/ucum/src/test/java/systems/uom/ucum/format/UnitFormatServiceTest.java @@ -44,7 +44,7 @@ public class UnitFormatServiceTest { @Test public void testGetService() throws Exception { - UnitFormatService ufs = ServiceProvider.current().getUnitFormatService(); + UnitFormatService ufs = ServiceProvider.current().getFormatService(); assertNotNull(ufs); assertNotNull(ufs.getUnitFormat()); assertEquals("Parsing", ufs.getUnitFormat().getClass().getSimpleName()); @@ -52,35 +52,35 @@ public void testGetService() throws Exception { @Test public void testGetCIFound() throws Exception { - UnitFormatService ufs = ServiceProvider.current().getUnitFormatService(); + UnitFormatService ufs = ServiceProvider.current().getFormatService(); assertNotNull(ufs); assertNotNull(ufs.getUnitFormat("CI")); } @Test public void testGetCSFound() throws Exception { - UnitFormatService ufs = ServiceProvider.current().getUnitFormatService(); + UnitFormatService ufs = ServiceProvider.current().getFormatService(); assertNotNull(ufs); assertNotNull(ufs.getUnitFormat("CS")); } @Test public void testGetPrintFound() throws Exception { - UnitFormatService ufs = ServiceProvider.current().getUnitFormatService(); + UnitFormatService ufs = ServiceProvider.current().getFormatService(); assertNotNull(ufs); assertNotNull(ufs.getUnitFormat("Print")); } @Test public void testGetFormatNotFound() throws Exception { - UnitFormatService ufs = ServiceProvider.current().getUnitFormatService(); + UnitFormatService ufs = ServiceProvider.current().getFormatService(); assertNotNull(ufs); assertNull(ufs.getUnitFormat("XYZ")); } @Test public void testGetFormatNotFoundEither() throws Exception { - UnitFormatService ufs = ServiceProvider.current().getUnitFormatService(); + UnitFormatService ufs = ServiceProvider.current().getFormatService(); assertNotNull(ufs); assertNotNull(ufs.getUnitFormat("UCUM")); }