File tree Expand file tree Collapse file tree 1 file changed +0
-14
lines changed
twin/src/test/java/com/iluwatar/twin Expand file tree Collapse file tree 1 file changed +0
-14
lines changed Original file line number Diff line number Diff line change 39
39
40
40
/** BallThreadTest */
41
41
class BallThreadTest {
42
-
43
42
/** Verify if the {@link BallThread} can be resumed */
44
43
@ Test
45
44
void testSuspend () {
46
45
assertTimeout (
47
46
ofMillis (5000 ),
48
47
() -> {
49
48
final var ballThread = new BallThread ();
50
-
51
49
final var ballItem = mock (BallItem .class );
52
50
ballThread .setTwin (ballItem );
53
-
54
51
ballThread .start ();
55
52
sleep (200 );
56
53
verify (ballItem , atLeastOnce ()).draw ();
57
54
verify (ballItem , atLeastOnce ()).move ();
58
55
ballThread .suspendMe ();
59
-
60
56
sleep (1000 );
61
-
62
57
ballThread .stopMe ();
63
58
ballThread .join ();
64
-
65
59
verifyNoMoreInteractions (ballItem );
66
60
});
67
61
}
@@ -73,25 +67,18 @@ void testResume() {
73
67
ofMillis (5000 ),
74
68
() -> {
75
69
final var ballThread = new BallThread ();
76
-
77
70
final var ballItem = mock (BallItem .class );
78
71
ballThread .setTwin (ballItem );
79
-
80
72
ballThread .suspendMe ();
81
73
ballThread .start ();
82
-
83
74
sleep (1000 );
84
-
85
75
verifyNoMoreInteractions (ballItem );
86
-
87
76
ballThread .resumeMe ();
88
77
sleep (300 );
89
78
verify (ballItem , atLeastOnce ()).draw ();
90
79
verify (ballItem , atLeastOnce ()).move ();
91
-
92
80
ballThread .stopMe ();
93
81
ballThread .join ();
94
-
95
82
verifyNoMoreInteractions (ballItem );
96
83
});
97
84
}
@@ -109,7 +96,6 @@ void testInterrupt() {
109
96
ballThread .start ();
110
97
ballThread .interrupt ();
111
98
ballThread .join ();
112
-
113
99
verify (exceptionHandler ).uncaughtException (eq (ballThread ), any (RuntimeException .class ));
114
100
verifyNoMoreInteractions (exceptionHandler );
115
101
});
You can’t perform that action at this time.
0 commit comments