3
3
import static org .junit .Assert .assertEquals ;
4
4
import static org .junit .Assert .assertNotNull ;
5
5
6
+ import org .audit4j .core .Audit4jTestBase ;
6
7
import org .junit .After ;
7
8
import org .junit .Before ;
8
9
import org .junit .Test ;
15
16
* @author JanithB
16
17
* @version $Revision: 1.0 $
17
18
*/
18
- public class StopWatchTest {
19
+ public class StopWatchTest extends Audit4jTestBase {
19
20
/**
20
21
* Run the StopWatch() constructor test.
21
22
*
@@ -105,6 +106,7 @@ public void testGetLastTaskName_1() throws Exception {
105
106
StopWatch fixture = new StopWatch ("" );
106
107
fixture .setKeepTaskList (true );
107
108
fixture .start ("" );
109
+ halt ();
108
110
fixture .stop ();
109
111
110
112
String result = fixture .getLastTaskName ();
@@ -125,6 +127,7 @@ public void testGetLastTaskName_2() throws Exception {
125
127
StopWatch fixture = new StopWatch ("" );
126
128
fixture .setKeepTaskList (true );
127
129
fixture .start ("" );
130
+ halt ();
128
131
fixture .stop ();
129
132
130
133
String result = fixture .getLastTaskName ();
@@ -145,6 +148,7 @@ public void testGetLastTaskTime_1() throws Exception {
145
148
StopWatch fixture = new StopWatch ("" );
146
149
fixture .setKeepTaskList (true );
147
150
fixture .start ("" );
151
+ halt ();
148
152
fixture .stop ();
149
153
150
154
long result = fixture .getLastTaskTime ();
@@ -165,6 +169,7 @@ public void testGetLastTaskTime_2() throws Exception {
165
169
StopWatch fixture = new StopWatch ("" );
166
170
fixture .setKeepTaskList (true );
167
171
fixture .start ("" );
172
+ halt ();
168
173
fixture .stop ();
169
174
170
175
long result = fixture .getLastTaskTime ();
@@ -185,6 +190,7 @@ public void testGetLastTaskTimeMillis_1() throws Exception {
185
190
StopWatch fixture = new StopWatch ("" );
186
191
fixture .setKeepTaskList (true );
187
192
fixture .start ("" );
193
+ halt ();
188
194
fixture .stop ();
189
195
190
196
long result = fixture .getLastTaskTimeMillis ();
@@ -205,6 +211,7 @@ public void testGetLastTaskTimeMillis_2() throws Exception {
205
211
StopWatch fixture = new StopWatch ("" );
206
212
fixture .setKeepTaskList (true );
207
213
fixture .start ("" );
214
+ halt ();
208
215
fixture .stop ();
209
216
210
217
long result = fixture .getLastTaskTimeMillis ();
@@ -225,6 +232,7 @@ public void testGetTaskCount_1() throws Exception {
225
232
StopWatch fixture = new StopWatch ("" );
226
233
fixture .setKeepTaskList (true );
227
234
fixture .start ("" );
235
+ halt ();
228
236
fixture .stop ();
229
237
230
238
int result = fixture .getTaskCount ();
@@ -245,6 +253,7 @@ public void testGetTaskInfo_1() throws Exception {
245
253
StopWatch fixture = new StopWatch ();
246
254
fixture .setKeepTaskList (true );
247
255
fixture .start ("test" );
256
+ halt ();
248
257
fixture .stop ();
249
258
250
259
StopWatch .TaskInfo [] result = fixture .getTaskInfo ();
@@ -271,6 +280,7 @@ public void testGetTaskInfo_2() throws Exception {
271
280
StopWatch fixture = new StopWatch ("" );
272
281
fixture .setKeepTaskList (false );
273
282
fixture .start ("" );
283
+ halt ();
274
284
fixture .stop ();
275
285
276
286
StopWatch .TaskInfo [] result = fixture .getTaskInfo ();
@@ -291,6 +301,7 @@ public void testGetTotalTime_1() throws Exception {
291
301
StopWatch fixture = new StopWatch ("" );
292
302
fixture .setKeepTaskList (true );
293
303
fixture .start ("" );
304
+ halt ();
294
305
fixture .stop ();
295
306
296
307
long result = fixture .getTotalTime ();
@@ -311,6 +322,7 @@ public void testGetTotalTimeMillis_1() throws Exception {
311
322
StopWatch fixture = new StopWatch ("" );
312
323
fixture .setKeepTaskList (true );
313
324
fixture .start ("" );
325
+ halt ();
314
326
fixture .stop ();
315
327
316
328
long result = fixture .getTotalTimeMillis ();
@@ -331,6 +343,7 @@ public void testGetTotalTimeSeconds_1() throws Exception {
331
343
StopWatch fixture = new StopWatch ("" );
332
344
fixture .setKeepTaskList (true );
333
345
fixture .start ("" );
346
+ halt ();
334
347
fixture .stop ();
335
348
336
349
double result = fixture .getTotalTimeSeconds ();
@@ -351,6 +364,7 @@ public void testIsRunning_1() throws Exception {
351
364
StopWatch fixture = new StopWatch ("" );
352
365
fixture .setKeepTaskList (true );
353
366
fixture .start ("" );
367
+ halt ();
354
368
fixture .stop ();
355
369
356
370
boolean result = fixture .isRunning ();
@@ -371,6 +385,7 @@ public void testIsRunning_2() throws Exception {
371
385
StopWatch fixture = new StopWatch ("" );
372
386
fixture .setKeepTaskList (true );
373
387
fixture .start ("" );
388
+ halt ();
374
389
fixture .stop ();
375
390
376
391
boolean result = fixture .isRunning ();
@@ -391,6 +406,7 @@ public void testPrettyPrint_1() throws Exception {
391
406
StopWatch fixture = new StopWatch ("" );
392
407
fixture .setKeepTaskList (true );
393
408
fixture .start ("" );
409
+ halt ();
394
410
fixture .stop ();
395
411
396
412
String result = fixture .prettyPrint ();
@@ -411,6 +427,7 @@ public void testPrettyPrint_2() throws Exception {
411
427
StopWatch fixture = new StopWatch ("" );
412
428
fixture .setKeepTaskList (true );
413
429
fixture .start ("" );
430
+ halt ();
414
431
fixture .stop ();
415
432
416
433
String result = fixture .prettyPrint ();
@@ -431,10 +448,12 @@ public void testPrettyPrint_3() throws Exception {
431
448
StopWatch fixture = new StopWatch ("" );
432
449
fixture .setKeepTaskList (false );
433
450
fixture .start ("" );
451
+ halt ();
434
452
fixture .stop ();
435
453
436
454
String result = fixture .prettyPrint ();
437
-
455
+ System .out .println (result );
456
+
438
457
// add additional test code here
439
458
assertEquals ("StopWatch '': running time (millis) = 0\n No task info kept" , result );
440
459
}
@@ -451,6 +470,7 @@ public void testReset_1() throws Exception {
451
470
StopWatch fixture = new StopWatch ("" );
452
471
fixture .setKeepTaskList (true );
453
472
fixture .start ("" );
473
+ halt ();
454
474
fixture .stop ();
455
475
456
476
fixture .reset ();
@@ -470,6 +490,7 @@ public void testSetKeepTaskList_1() throws Exception {
470
490
StopWatch fixture = new StopWatch ("" );
471
491
fixture .setKeepTaskList (true );
472
492
fixture .start ("" );
493
+ halt ();
473
494
fixture .stop ();
474
495
boolean keepTaskList = true ;
475
496
@@ -490,6 +511,7 @@ public void testShortSummary_1() throws Exception {
490
511
StopWatch fixture = new StopWatch ("" );
491
512
fixture .setKeepTaskList (true );
492
513
fixture .start ("" );
514
+ halt ();
493
515
fixture .stop ();
494
516
495
517
String result = fixture .shortSummary ();
@@ -510,6 +532,7 @@ public void testStart_1() throws Exception {
510
532
StopWatch fixture = new StopWatch ("" );
511
533
fixture .setKeepTaskList (true );
512
534
fixture .start ("" );
535
+ halt ();
513
536
fixture .stop ();
514
537
515
538
fixture .start ();
@@ -529,6 +552,7 @@ public void testStart_2() throws Exception {
529
552
StopWatch fixture = new StopWatch ("" );
530
553
fixture .setKeepTaskList (true );
531
554
fixture .start ("" );
555
+ halt ();
532
556
fixture .stop ();
533
557
534
558
fixture .start ();
@@ -548,6 +572,7 @@ public void testStart_3() throws Exception {
548
572
StopWatch fixture = new StopWatch ("" );
549
573
fixture .setKeepTaskList (true );
550
574
fixture .start ("" );
575
+ halt ();
551
576
fixture .stop ();
552
577
String taskName = "" ;
553
578
@@ -568,6 +593,7 @@ public void testStart_4() throws Exception {
568
593
StopWatch fixture = new StopWatch ("" );
569
594
fixture .setKeepTaskList (true );
570
595
fixture .start ("" );
596
+ halt ();
571
597
fixture .stop ();
572
598
String taskName = "" ;
573
599
@@ -588,6 +614,7 @@ public void testStop_1() throws Exception {
588
614
StopWatch fixture = new StopWatch ("" );
589
615
fixture .setKeepTaskList (true );
590
616
fixture .start ("" );
617
+ halt ();
591
618
fixture .stop ();
592
619
593
620
fixture .stop ();
@@ -607,6 +634,7 @@ public void testStop_2() throws Exception {
607
634
StopWatch fixture = new StopWatch ("" );
608
635
fixture .setKeepTaskList (true );
609
636
fixture .start ("" );
637
+ halt ();
610
638
fixture .stop ();
611
639
612
640
fixture .stop ();
@@ -626,6 +654,7 @@ public void testStop_3() throws Exception {
626
654
StopWatch fixture = new StopWatch ("" );
627
655
fixture .setKeepTaskList (false );
628
656
fixture .start ("" );
657
+ halt ();
629
658
fixture .stop ();
630
659
631
660
fixture .stop ();
@@ -645,6 +674,7 @@ public void testToString_1() throws Exception {
645
674
StopWatch fixture = new StopWatch ("" );
646
675
fixture .setKeepTaskList (false );
647
676
fixture .start ("" );
677
+ halt ();
648
678
fixture .stop ();
649
679
650
680
String result = fixture .toString ();
@@ -665,6 +695,7 @@ public void testToString_2() throws Exception {
665
695
StopWatch fixture = new StopWatch ("" );
666
696
fixture .setKeepTaskList (true );
667
697
fixture .start ("" );
698
+ halt ();
668
699
fixture .stop ();
669
700
670
701
String result = fixture .toString ();
@@ -685,6 +716,7 @@ public void testToString_3() throws Exception {
685
716
StopWatch fixture = new StopWatch ("" );
686
717
fixture .setKeepTaskList (true );
687
718
fixture .start ("" );
719
+ halt ();
688
720
fixture .stop ();
689
721
690
722
String result = fixture .toString ();
0 commit comments