@@ -131,9 +131,8 @@ void testSetup() {
131131 }
132132
133133 @ ParameterizedTest
134- @ MethodSource ("numericAttributeArgs" )
135- void testNumericAttributeInfo (
136- String attributeName , boolean usesDoubleValues , Number expectedValue ) {
134+ @ MethodSource ("numericAttributeInfoArgs" )
135+ void testNumericAttributeInfo (String attributeName , boolean usesDoubleValues ) {
137136 BeanAttributeExtractor extractor = BeanAttributeExtractor .fromName (attributeName );
138137 AttributeInfo info = extractor .getAttributeInfo (theServer , objectName );
139138
@@ -142,18 +141,23 @@ void testNumericAttributeInfo(
142141 }
143142
144143 @ ParameterizedTest
145- @ MethodSource ("numericAttributeArgs" )
146- void testNumericAttributeValue (
147- String attributeName , boolean usesDoubleValues , Number expectedValue ) {
144+ @ MethodSource ("integralNumericAttributeArgs" )
145+ void testIntegralNumericAttributeValue (String attributeName , long expectedValue ) {
148146 BeanAttributeExtractor extractor = BeanAttributeExtractor .fromName (attributeName );
149147 Number number = extractor .extractNumericalAttribute (theServer , objectName );
150148
151149 assertThat (number ).isNotNull ();
152- if (usesDoubleValues ) {
153- assertThat (number .doubleValue ()).isEqualTo (expectedValue .doubleValue ());
154- } else {
155- assertThat (number .longValue ()).isEqualTo (expectedValue .longValue ());
156- }
150+ assertThat (number .longValue ()).isEqualTo (expectedValue );
151+ }
152+
153+ @ ParameterizedTest
154+ @ MethodSource ("floatingPointNumericAttributeArgs" )
155+ void testFloatingPointNumericAttributeValue (String attributeName , double expectedValue ) {
156+ BeanAttributeExtractor extractor = BeanAttributeExtractor .fromName (attributeName );
157+ Number number = extractor .extractNumericalAttribute (theServer , objectName );
158+
159+ assertThat (number ).isNotNull ();
160+ assertThat (number .doubleValue ()).isEqualTo (expectedValue );
157161 }
158162
159163 @ Test
@@ -200,13 +204,25 @@ void testNegativeFilter(String attributeName) {
200204 .isNull ();
201205 }
202206
203- private static Stream <Arguments > numericAttributeArgs () {
207+ private static Stream <Arguments > numericAttributeInfoArgs () {
208+ return Stream .of (
209+ Arguments .of ("ByteAttribute" , false ),
210+ Arguments .of ("ShortAttribute" , false ),
211+ Arguments .of ("IntAttribute" , false ),
212+ Arguments .of ("LongAttribute" , false ),
213+ Arguments .of ("FloatAttribute" , true ),
214+ Arguments .of ("DoubleAttribute" , true ));
215+ }
216+
217+ private static Stream <Arguments > integralNumericAttributeArgs () {
204218 return Stream .of (
205- Arguments .of ("ByteAttribute" , false , 10L ),
206- Arguments .of ("ShortAttribute" , false , 11L ),
207- Arguments .of ("IntAttribute" , false , 12L ),
208- Arguments .of ("LongAttribute" , false , 13L ),
209- Arguments .of ("FloatAttribute" , true , 14.0 ),
210- Arguments .of ("DoubleAttribute" , true , 15.0 ));
219+ Arguments .of ("ByteAttribute" , 10L ),
220+ Arguments .of ("ShortAttribute" , 11L ),
221+ Arguments .of ("IntAttribute" , 12L ),
222+ Arguments .of ("LongAttribute" , 13L ));
223+ }
224+
225+ private static Stream <Arguments > floatingPointNumericAttributeArgs () {
226+ return Stream .of (Arguments .of ("FloatAttribute" , 14.0 ), Arguments .of ("DoubleAttribute" , 15.0 ));
211227 }
212228}
0 commit comments