|
1 | 1 | /* |
2 | | - * Unit-API - Units of Measurement API for Java Copyright (c) 2005-2015, Jean-Marie Dautelle, Werner |
| 2 | + * Units of Measurement TCK for Java Copyright (c) 2005-2016, Jean-Marie Dautelle, Werner |
3 | 3 | * Keil, V2COM. |
4 | 4 | * |
5 | 5 | * All rights reserved. |
|
30 | 30 |
|
31 | 31 | import static tec.units.tck.TCKRunner.SPEC_ID; |
32 | 32 | import static tec.units.tck.TCKRunner.SPEC_VERSION; |
| 33 | + |
33 | 34 | import java.util.Map; |
| 35 | + |
34 | 36 | import javax.measure.Dimension; |
| 37 | + |
35 | 38 | import org.jboss.test.audit.annotations.SpecAssertion; |
36 | 39 | import org.jboss.test.audit.annotations.SpecVersion; |
37 | 40 | import org.testng.annotations.Test; |
| 41 | + |
38 | 42 | import tec.units.tck.TCKSetup; |
39 | 43 | import tec.units.tck.util.TestUtils; |
40 | 44 |
|
|
45 | 49 | */ |
46 | 50 | @SpecVersion(spec = SPEC_ID, version = SPEC_VERSION) |
47 | 51 | public class UnitDimensionTest { |
48 | | - |
| 52 | + private static final String SECTION = "4.2.4"; |
| 53 | + |
49 | 54 | /** |
50 | 55 | * Test that Dimension implementations override equals. |
51 | 56 | */ |
52 | | - @SpecAssertion(section = "4.2.4", id = "424-A1") |
53 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override equals.") |
| 57 | + @SpecAssertion(section = SECTION, id = "424-A1") |
| 58 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override equals.") |
54 | 59 | public void testUnitEquals() { |
55 | 60 | for (@SuppressWarnings("rawtypes") |
56 | 61 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
57 | | - TestUtils.testHasPublicMethod("Section 4.2.1", type, boolean.class, "equals", Object.class); |
| 62 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, boolean.class, "equals", Object.class); |
58 | 63 | } |
59 | 64 | } |
60 | 65 |
|
61 | 66 | /** |
62 | 67 | * Test that Dimension implementations override hashCode. |
63 | 68 | */ |
64 | | - @SpecAssertion(section = "4.2.4", id = "424-A2") |
65 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override hashCode.") |
| 69 | + @SpecAssertion(section = SECTION, id = "424-A2") |
| 70 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override hashCode.") |
66 | 71 | public void testUnitHashcode() { |
67 | 72 | for (@SuppressWarnings("rawtypes") |
68 | 73 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
69 | | - TestUtils.testHasPublicMethod("Section 4.2.4", type, int.class, "hashCode"); |
| 74 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, int.class, "hashCode"); |
70 | 75 | } |
71 | 76 | } |
72 | 77 |
|
73 | 78 | /** |
74 | 79 | * Test that Dimension implementations override multiply. |
75 | 80 | */ |
76 | | - @SpecAssertion(section = "4.2.4", id = "424-A3") |
77 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override multiply.") |
| 81 | + @SpecAssertion(section = SECTION, id = "424-A3") |
| 82 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override multiply.") |
78 | 83 | public void testUnitMultiply() { |
79 | 84 | for (@SuppressWarnings("rawtypes") |
80 | 85 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
81 | | - TestUtils.testHasPublicMethod("Section 4.2.4", type, Dimension.class, "multiply", Dimension.class); |
| 86 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, Dimension.class, "multiply", Dimension.class); |
82 | 87 | } |
83 | 88 | } |
84 | 89 |
|
85 | 90 | /** |
86 | 91 | * Test that Dimension implementations override divide. |
87 | 92 | */ |
88 | | - @SpecAssertion(section = "4.2.4", id = "424-A4") |
89 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override divide.") |
| 93 | + @SpecAssertion(section = SECTION, id = "424-A4") |
| 94 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override divide.") |
90 | 95 | public void testUnitDivide() { |
91 | 96 | for (@SuppressWarnings("rawtypes") |
92 | 97 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
93 | | - TestUtils.testHasPublicMethod("Section 4.2.4", type, Dimension.class, "divide", Dimension.class); |
| 98 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, Dimension.class, "divide", Dimension.class); |
94 | 99 | } |
95 | 100 | } |
96 | 101 |
|
97 | 102 | /** |
98 | 103 | * Test that Dimension implementations override root. |
99 | 104 | */ |
100 | | - @SpecAssertion(section = "4.2.4", id = "424-A5") |
101 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override root.") |
| 105 | + @SpecAssertion(section = SECTION, id = "424-A5") |
| 106 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override root.") |
102 | 107 | public void testUnitRoot() { |
103 | 108 | for (@SuppressWarnings("rawtypes") |
104 | 109 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
105 | | - TestUtils.testHasPublicMethod("Section 4.2.4", type, Dimension.class, "root", int.class); |
| 110 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, Dimension.class, "root", int.class); |
106 | 111 | } |
107 | 112 | } |
108 | 113 |
|
109 | 114 | /** |
110 | 115 | * Test that Dimension implementations override pow. |
111 | 116 | */ |
112 | | - @SpecAssertion(section = "4.2.4", id = "424-A6") |
113 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override pow.") |
| 117 | + @SpecAssertion(section = SECTION, id = "424-A6") |
| 118 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override pow.") |
114 | 119 | public void testUnitPow() { |
115 | 120 | for (@SuppressWarnings("rawtypes") |
116 | 121 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
117 | | - TestUtils.testHasPublicMethod("Section 4.2.4", type, Dimension.class, "pow", int.class); |
| 122 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, Dimension.class, "pow", int.class); |
118 | 123 | } |
119 | 124 | } |
120 | 125 |
|
121 | 126 | /** |
122 | 127 | * Test that Dimension implementations override getBaseDimensions. |
123 | 128 | */ |
124 | | - @SpecAssertion(section = "4.2.4", id = "424-A7") |
125 | | - @Test(groups = {"core"}, description = "4.2.4 Ensure registered Dimension classes override getBaseDimensions.") |
| 129 | + @SpecAssertion(section = SECTION, id = "424-A7") |
| 130 | + @Test(groups = {"core"}, description = SECTION + " Ensure registered Dimension classes override getBaseDimensions.") |
126 | 131 | public void testUnitGetProductDimensions() { |
127 | 132 | for (@SuppressWarnings("rawtypes") |
128 | 133 | Class type : TCKSetup.getConfiguration().getDimensionClasses()) { |
129 | | - TestUtils.testHasPublicMethod("Section 4.2.4", type, Map.class, "getBaseDimensions"); |
| 134 | + TestUtils.testHasPublicMethod("Section "+ SECTION, type, Map.class, "getBaseDimensions"); |
130 | 135 | } |
131 | 136 | } |
132 | 137 | } |
0 commit comments