diff --git a/pom.xml b/pom.xml index 8444a70..2de8f24 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 tec.units unit-tck - 0.3-SNAPSHOT + 0.3 jar Units of Measurement TCK http://github.com/unitsofmeasurement/unit-tck diff --git a/src/main/java/tec/units/tck/TCKRunner.java b/src/main/java/tec/units/tck/TCKRunner.java index 5e4e2f3..e2fce28 100644 --- a/src/main/java/tec/units/tck/TCKRunner.java +++ b/src/main/java/tec/units/tck/TCKRunner.java @@ -25,10 +25,6 @@ */ package tec.units.tck; - -import static tec.units.tck.util.TestGroups.FORMAT; -import static tec.units.tck.util.TestGroups.FULL; -import static tec.units.tck.util.TestGroups.MINIMAL; import static tec.units.tck.util.TestGroups.SYS_PROPERTY_PROFILE; import org.testng.ITestResult; @@ -42,6 +38,8 @@ import tec.units.tck.tests.*; import tec.units.tck.util.TestGroups; +import tec.units.tck.util.TestGroups.Group; +import tec.units.tck.util.TestGroups.Profile; import tec.uom.lib.common.function.Versioned; import java.lang.reflect.Method; @@ -68,37 +66,22 @@ */ public class TCKRunner extends XmlSuite implements Tool, Versioned { /** - * - */ + * + */ private static final long serialVersionUID = 3189431432291353154L; private static final String VERSION_NUMBER = "0.3"; - private final String profile; + private final Profile profile; public TCKRunner() { setName("JSR363-TCK " + VERSION_NUMBER); XmlTest test = new XmlTest(this); - profile = System.getProperty(SYS_PROPERTY_PROFILE, FULL); - - switch(profile) { - case MINIMAL: - for (TestGroups.Group group : TestGroups.MINIMAL_GROUPS) { - test.addIncludedGroup(group.name()); - } - break; - case FORMAT: - for (TestGroups.Group group : TestGroups.FORMAT_GROUPS) { - test.addIncludedGroup(group.name()); - } - break; - default: - for (TestGroups.Group group : TestGroups.Group.values()) { - test.addIncludedGroup(group.name()); - } + profile = Profile.valueOf(System.getProperty(SYS_PROPERTY_PROFILE, Profile.full.name())); + for (Group group : profile.getGroups()) { + test.addIncludedGroup(group.name()); } - test.setName("TCK/Test Setup"); List classes = new ArrayList<>(); classes.add(new XmlClass(TCKSetup.class)); diff --git a/src/main/java/tec/units/tck/util/TestGroups.java b/src/main/java/tec/units/tck/util/TestGroups.java index 2725f89..6caa5be 100644 --- a/src/main/java/tec/units/tck/util/TestGroups.java +++ b/src/main/java/tec/units/tck/util/TestGroups.java @@ -1,6 +1,7 @@ package tec.units.tck.util; import static tec.units.tck.util.TestGroups.Group.*; +import tec.uom.lib.common.function.DescriptionSupplier; /** * TestNG group profiles used in the JSR 363 TCK. @@ -31,30 +32,15 @@ public enum Group { core, format, base_quantity, derived_quantity, spi } - /** - * Full profile (default if none is given) - */ - public static final String FULL = "full"; - - /** - * Minimal profile - */ - public static final String MINIMAL = "minimal"; - /** * Minimal groups */ - public static final Group[] MINIMAL_GROUPS = {core}; - - /** - * Format profile - */ - public static final String FORMAT = "format"; + private static final Group[] MINIMAL_GROUPS = {core}; /** * Format groups */ - public static final Group[] FORMAT_GROUPS = {core, format}; + private static final Group[] FORMAT_GROUPS = {core, format}; /** * Base Quantity groups @@ -83,7 +69,7 @@ public enum Group { * * @author Werner Keil */ - public enum Profile { + public enum Profile implements DescriptionSupplier { minimal("Minimal", MINIMAL_GROUPS), format("Format", FORMAT_GROUPS), base_quantity("Base Quantity", BASE_QUANTITY_GROUPS), quantity("Quantity", QUANTITY_GROUPS), spi("SPI", SPI_GROUPS), full("Full", Group.values()); @@ -95,13 +81,19 @@ private Profile(String description, Group[] groups) { this.description = description; this.groups = groups; } - - public String getDescription() { - return description; - } public Group[] getGroups() { return groups; + } + + @Override + /* + * (non-Javadoc) + * + * @see DescriptionSupplier + */ + public String getDescription() { + return description; } }