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 3939
4040/** BallThreadTest */
4141class BallThreadTest {
42-
4342 /** Verify if the {@link BallThread} can be resumed */
4443 @ Test
4544 void testSuspend () {
4645 assertTimeout (
4746 ofMillis (5000 ),
4847 () -> {
4948 final var ballThread = new BallThread ();
50-
5149 final var ballItem = mock (BallItem .class );
5250 ballThread .setTwin (ballItem );
53-
5451 ballThread .start ();
5552 sleep (200 );
5653 verify (ballItem , atLeastOnce ()).draw ();
5754 verify (ballItem , atLeastOnce ()).move ();
5855 ballThread .suspendMe ();
59-
6056 sleep (1000 );
61-
6257 ballThread .stopMe ();
6358 ballThread .join ();
64-
6559 verifyNoMoreInteractions (ballItem );
6660 });
6761 }
@@ -73,25 +67,18 @@ void testResume() {
7367 ofMillis (5000 ),
7468 () -> {
7569 final var ballThread = new BallThread ();
76-
7770 final var ballItem = mock (BallItem .class );
7871 ballThread .setTwin (ballItem );
79-
8072 ballThread .suspendMe ();
8173 ballThread .start ();
82-
8374 sleep (1000 );
84-
8575 verifyNoMoreInteractions (ballItem );
86-
8776 ballThread .resumeMe ();
8877 sleep (300 );
8978 verify (ballItem , atLeastOnce ()).draw ();
9079 verify (ballItem , atLeastOnce ()).move ();
91-
9280 ballThread .stopMe ();
9381 ballThread .join ();
94-
9582 verifyNoMoreInteractions (ballItem );
9683 });
9784 }
@@ -109,7 +96,6 @@ void testInterrupt() {
10996 ballThread .start ();
11097 ballThread .interrupt ();
11198 ballThread .join ();
112-
11399 verify (exceptionHandler ).uncaughtException (eq (ballThread ), any (RuntimeException .class ));
114100 verifyNoMoreInteractions (exceptionHandler );
115101 });
You can’t perform that action at this time.
0 commit comments