File tree Expand file tree Collapse file tree
2026-02-05-Retro_Copilot/src/test/java/de/hilling/chess Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package de .hilling .chess ;
22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import static org .junit .jupiter .api .Assertions .assertThrows ;
45import static org .junit .jupiter .api .Assertions .fail ;
56
67import org .junit .jupiter .api .BeforeEach ;
@@ -65,22 +66,13 @@ void testSetupToString() {
6566
6667 @ Test
6768 void illegalMoveLength () {
68- try {
69- chessGame .move ("a2a4bb" );
70- fail ("Illegal move exception" );
71- } catch (IllegalArgumentException iae ) {
72- // nothing to do
73- }
69+ assertThrows (IllegalArgumentException .class , () -> chessGame .move ("a2a4bb" ));
7470 }
7571
7672 @ Test
7773 void illegalMoveCharacters () {
78- try {
79- chessGame .move ("a2z4" );
80- fail ("Illegal move exception" );
81- } catch (IllegalArgumentException iae ) {
82- assertEquals ("Illegal position: z4" , iae .getMessage ());
83- }
74+ IllegalArgumentException iae = assertThrows (IllegalArgumentException .class , () -> chessGame .move ("a2z4" ));
75+ assertEquals ("Illegal position: z4" , iae .getMessage ());
8476 }
8577
8678 @ Test
You can’t perform that action at this time.
0 commit comments