2727import static java .lang .Thread .UncaughtExceptionHandler ;
2828import static java .lang .Thread .sleep ;
2929import static java .time .Duration .ofMillis ;
30+ import static org .junit .jupiter .api .Assertions .assertEquals ;
3031import static org .junit .jupiter .api .Assertions .assertTimeout ;
3132import static org .mockito .ArgumentMatchers .any ;
3233import static org .mockito .ArgumentMatchers .eq ;
3536import static org .mockito .Mockito .verify ;
3637import static org .mockito .Mockito .verifyNoMoreInteractions ;
3738
39+ import lombok .extern .slf4j .Slf4j ;
3840import org .junit .jupiter .api .Test ;
3941
4042/**
4143 * BallThreadTest
4244 *
4345 */
46+ @ Slf4j
4447class BallThreadTest {
4548
4649 /**
@@ -59,12 +62,12 @@ void testSuspend() {
5962 verify (ballItem , atLeastOnce ()).draw ();
6063 verify (ballItem , atLeastOnce ()).move ();
6164 ballThread .suspendMe ();
62-
6365 sleep (1000 );
66+ LOGGER .info ("Current ballThread State: " +ballThread .getState ());
67+ assertEquals (ballThread .getState (), Thread .State .WAITING );
6468
6569 ballThread .stopMe ();
6670 ballThread .join ();
67-
6871 verifyNoMoreInteractions (ballItem );
6972 });
7073 }
@@ -86,8 +89,9 @@ void testResume() {
8689 sleep (1000 );
8790
8891 verifyNoMoreInteractions (ballItem );
89-
9092 ballThread .resumeMe ();
93+ LOGGER .info ("Current ballThread State: " +ballThread .getState ());
94+ assertEquals (ballThread .getState (), Thread .State .RUNNABLE );
9195 sleep (300 );
9296 verify (ballItem , atLeastOnce ()).draw ();
9397 verify (ballItem , atLeastOnce ()).move ();
0 commit comments