@@ -109,20 +109,20 @@ public void givenTimer_whenExecuteTask_thenTimerUpdated() throws Exception {
109109 .build (), MILLISECONDS );
110110
111111 Stopwatch stopwatch = timer .start ();
112- MILLISECONDS .sleep (1 );
113- timer .record (2 , MILLISECONDS );
112+ SECONDS .sleep (1 );
113+ timer .record (2 , SECONDS );
114114 stopwatch .stop ();
115115
116- assertEquals ("timer should count 1 millisecond " , 1 , timer
116+ assertEquals ("timer should count 1 second " , 1000 , timer
117117 .getValue ()
118- .intValue ());
119- assertEquals ("timer should count 3 millisecond in total" , 3 , timer .getTotalTime ()
120- .intValue ());
118+ .intValue (), 1000 );
119+ assertEquals ("timer should count 3 second in total" , 3000 , timer .getTotalTime ()
120+ .intValue (), 1000 );
121121 assertEquals ("timer should record 2 updates" , 2 , timer
122122 .getCount ()
123123 .intValue ());
124124
125- assertEquals ("timer should have max 2" , 2 , timer .getMax (), 0.01 );
125+ assertEquals ("timer should have max 2" , 2000 , timer .getMax (), 0.01 );
126126 }
127127
128128 @ Test
@@ -161,7 +161,6 @@ private static String getMonitorTagValue(Monitor monitor, String tagKey) {
161161 }
162162
163163 @ Test
164- //==
165164 public void givenStatsTimer_whenExecuteTask_thenStatsCalculated () throws Exception {
166165 System .setProperty ("netflix.servo" , "1000" );
167166 StatsTimer timer = new StatsTimer (MonitorConfig
@@ -178,21 +177,21 @@ public void givenStatsTimer_whenExecuteTask_thenStatsCalculated() throws Excepti
178177 .build (), MILLISECONDS );
179178
180179 Stopwatch stopwatch = timer .start ();
181- MILLISECONDS .sleep (1 );
182- timer .record (3 , MILLISECONDS );
180+ SECONDS .sleep (1 );
181+ timer .record (3 , SECONDS );
183182 stopwatch .stop ();
184183
185184 stopwatch = timer .start ();
186- timer .record (6 , MILLISECONDS );
187- MILLISECONDS .sleep (2 );
185+ timer .record (6 , SECONDS );
186+ SECONDS .sleep (2 );
188187 stopwatch .stop ();
189188
190- assertEquals ("timer should count 12 milliseconds in total" , 12 , timer .getTotalTime ());
191- assertEquals ("timer should count 12 milliseconds in total" , 12 , timer .getTotalMeasurement ());
189+ assertEquals ("timer should count 12 seconds in total" , 12000 , timer .getTotalTime (), 500 );
190+ assertEquals ("timer should count 12 seconds in total" , 12000 , timer .getTotalMeasurement (), 500 );
192191 assertEquals ("timer should record 4 updates" , 4 , timer .getCount ());
193- assertEquals ("stats timer value time-cost/update should be 2" , 3 , timer
192+ assertEquals ("stats timer value time-cost/update should be 2" , 3000 , timer
194193 .getValue ()
195- .intValue ());
194+ .intValue (), 500 );
196195
197196 final Map <String , Number > metricMap = timer
198197 .getMonitors ()
@@ -235,4 +234,4 @@ public void givenInformationalMonitor_whenRecord_thenInformationCollected() thro
235234 assertEquals ("information collected" , informational .getValue ());
236235 }
237236
238- }
237+ }
0 commit comments