3737public class DPIUtilTests {
3838
3939 private int deviceZoom ;
40+ private static final int ZOOM_200 = 200 ;
4041
4142 @ BeforeEach
4243 public void setup () {
4344 deviceZoom = DPIUtil .getDeviceZoom ();
44- DPIUtil .setDeviceZoom (200 );
45+ DPIUtil .setDeviceZoom (ZOOM_200 );
4546 }
4647
4748 @ AfterEach
@@ -57,10 +58,10 @@ public void scaleDownFloatArray() {
5758
5859 float [] scaledValue = DPIUtil .autoScaleDown (valueAt200 );
5960 assertArrayEquals (valueAt100 , scaledValue , .001f , String .format ("Scaling down float array from device zoom (%d) to 100 failed" ,
60- DPIUtil . getDeviceZoom () ));
61+ ZOOM_200 ));
6162 scaledValue = DPIUtil .autoScaleDown ((Device ) null , valueAt200 );
6263 assertArrayEquals (valueAt100 , scaledValue , .001f , String .format ("Scaling down float array from device zoom (%d) to 100 with device failed" ,
63- DPIUtil . getDeviceZoom () ));
64+ ZOOM_200 ));
6465
6566 scaledValue = DPIUtil .scaleDown (valueAt200 , 200 );
6667 assertArrayEquals (valueAt100 , scaledValue , .001f , "Scaling down float array from 200 failed" );
@@ -84,10 +85,10 @@ public void scaleDownInteger() {
8485
8586 int scaledValue = DPIUtil .autoScaleDown (valueAt200 );
8687 assertEquals (
87- valueAt100 , scaledValue , String .format ("Scaling down integer from device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
88+ valueAt100 , scaledValue , String .format ("Scaling down integer from device zoom (%d) to 100 failed" , ZOOM_200 ));
8889 scaledValue = DPIUtil .autoScaleDown ((Device ) null , valueAt200 );
8990 assertEquals (
90- valueAt100 , scaledValue , String .format ("Scaling down integer from device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
91+ valueAt100 , scaledValue , String .format ("Scaling down integer from device zoom (%d) to 100 with device failed" , ZOOM_200 ));
9192
9293 scaledValue = DPIUtil .scaleDown (valueAt200 , 200 );
9394 assertEquals (valueAt100 , scaledValue , "Scaling down integer from 200 failed" );
@@ -111,10 +112,10 @@ public void scaleDownFloat() {
111112
112113 float scaledValue = DPIUtil .autoScaleDown (valueAt200 );
113114 assertEquals (valueAt100 , scaledValue , .001f ,
114- String .format ("Scaling down float from device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
115+ String .format ("Scaling down float from device zoom (%d) to 100 failed" , ZOOM_200 ));
115116 scaledValue = DPIUtil .autoScaleDown ((Device ) null , valueAt200 );
116117 assertEquals (valueAt100 , scaledValue , .001f , String
117- .format ("Scaling down float from device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
118+ .format ("Scaling down float from device zoom (%d) to 100 with device failed" , ZOOM_200 ));
118119
119120 scaledValue = DPIUtil .scaleDown (valueAt200 , 200 );
120121 assertEquals (valueAt100 , scaledValue , .001f , "Scaling down float from 200 failed" );
@@ -138,10 +139,10 @@ public void scaleDownPoint() {
138139
139140 Point scaledValue = DPIUtil .autoScaleDown (valueAt200 );
140141 assertEquals (valueAt100 , scaledValue ,
141- String .format ("Scaling down Point from device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
142+ String .format ("Scaling down Point from device zoom (%d) to 100 failed" , ZOOM_200 ));
142143 scaledValue = DPIUtil .autoScaleDown ((Device ) null , valueAt200 );
143144 assertEquals (valueAt100 , scaledValue , String
144- .format ("Scaling down Point from device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
145+ .format ("Scaling down Point from device zoom (%d) to 100 with device failed" , ZOOM_200 ));
145146
146147 scaledValue = DPIUtil .scaleDown (valueAt200 , 200 );
147148 assertEquals (valueAt100 , scaledValue , "Scaling down Point from 200 failed" );
@@ -165,10 +166,10 @@ public void scaleDownRectangle() {
165166
166167 Rectangle scaledValue = DPIUtil .autoScaleDown (valueAt200 );
167168 assertEquals (valueAt100 , scaledValue ,
168- String .format ("Scaling down Rectangle from device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
169+ String .format ("Scaling down Rectangle from device zoom (%d) to 100 failed" , ZOOM_200 ));
169170 scaledValue = DPIUtil .autoScaleDown ((Device ) null , valueAt200 );
170171 assertEquals (valueAt100 , scaledValue , String .format (
171- "Scaling down Rectangle from device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
172+ "Scaling down Rectangle from device zoom (%d) to 100 with device failed" , ZOOM_200 ));
172173
173174 scaledValue = DPIUtil .scaleDown (valueAt200 , 200 );
174175 assertEquals (valueAt100 , scaledValue , "Scaling down Rectangle from 200 failed" );
@@ -192,10 +193,10 @@ public void scaleUpIntArray() {
192193
193194 int [] scaledValue = DPIUtil .autoScaleUp (valueAt100 );
194195 assertArrayEquals (valueAt200 , scaledValue ,
195- String .format ("Scaling up int array to device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
196+ String .format ("Scaling up int array to device zoom (%d) to 100 failed" , ZOOM_200 ));
196197 scaledValue = DPIUtil .autoScaleUp ((Device ) null , valueAt100 );
197198 assertArrayEquals (valueAt200 , scaledValue , String
198- .format ("Scaling up int array to device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
199+ .format ("Scaling up int array to device zoom (%d) to 100 with device failed" , ZOOM_200 ));
199200
200201 scaledValue = DPIUtil .scaleUp (valueAt100 , 200 );
201202 assertArrayEquals (valueAt200 , scaledValue , "Scaling up int array to 200 failed" );
@@ -219,10 +220,10 @@ public void scaleUpInteger() {
219220
220221 int scaledValue = DPIUtil .autoScaleUp (valueAt100 );
221222 assertEquals (valueAt200 , scaledValue ,
222- String .format ("Scaling up integer to device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
223+ String .format ("Scaling up integer to device zoom (%d) to 100 failed" , ZOOM_200 ));
223224 scaledValue = DPIUtil .autoScaleUp ((Device ) null , valueAt100 );
224225 assertEquals (valueAt200 , scaledValue , String
225- .format ("Scaling up integer to device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
226+ .format ("Scaling up integer to device zoom (%d) to 100 with device failed" , ZOOM_200 ));
226227
227228 scaledValue = DPIUtil .scaleUp (valueAt100 , 200 );
228229 assertEquals (valueAt200 , scaledValue , "Scaling up integer to 200 failed" );
@@ -246,10 +247,10 @@ public void scaleUpFloat() {
246247
247248 float scaledValue = DPIUtil .autoScaleUp (valueAt100 );
248249 assertEquals (valueAt200 , scaledValue , 0.001f ,
249- String .format ("Scaling up integer to device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
250+ String .format ("Scaling up integer to device zoom (%d) to 100 failed" , ZOOM_200 ));
250251 scaledValue = DPIUtil .autoScaleUp ((Device ) null , valueAt100 );
251252 assertEquals (valueAt200 , scaledValue , 0.001f , String
252- .format ("Scaling up integer to device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
253+ .format ("Scaling up integer to device zoom (%d) to 100 with device failed" , ZOOM_200 ));
253254
254255 scaledValue = DPIUtil .scaleUp (valueAt100 , 200 );
255256 assertEquals (valueAt200 , scaledValue , 0.001f , "Scaling up integer to 200 failed" );
@@ -273,10 +274,10 @@ public void scaleUpPoint() {
273274
274275 Point scaledValue = DPIUtil .autoScaleUp (valueAt100 );
275276 assertEquals (valueAt200 , scaledValue ,
276- String .format ("Scaling up Point to device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
277+ String .format ("Scaling up Point to device zoom (%d) to 100 failed" , ZOOM_200 ));
277278 scaledValue = DPIUtil .autoScaleUp ((Device ) null , valueAt100 );
278279 assertEquals (valueAt200 , scaledValue , String
279- .format ("Scaling up Point to device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
280+ .format ("Scaling up Point to device zoom (%d) to 100 with device failed" , ZOOM_200 ));
280281
281282 scaledValue = DPIUtil .scaleUp (valueAt100 , 200 );
282283 assertEquals (valueAt200 , scaledValue , "Scaling up Point to 200 failed" );
@@ -300,10 +301,10 @@ public void scaleUpRectangle() {
300301
301302 Rectangle scaledValue = DPIUtil .autoScaleUp (valueAt100 );
302303 assertEquals (valueAt200 , scaledValue ,
303- String .format ("Scaling up Rectangle to device zoom (%d) to 100 failed" , DPIUtil . getDeviceZoom () ));
304+ String .format ("Scaling up Rectangle to device zoom (%d) to 100 failed" , ZOOM_200 ));
304305 scaledValue = DPIUtil .autoScaleUp ((Device ) null , valueAt100 );
305306 assertEquals (valueAt200 , scaledValue , String
306- .format ("Scaling up Rectangle to device zoom (%d) to 100 with device failed" , DPIUtil . getDeviceZoom () ));
307+ .format ("Scaling up Rectangle to device zoom (%d) to 100 with device failed" , ZOOM_200 ));
307308
308309 scaledValue = DPIUtil .scaleUp (valueAt100 , 200 );
309310 assertEquals (valueAt200 , scaledValue , "Scaling up Rectangle to 200 failed" );
0 commit comments