Skip to content

Commit bb29c12

Browse files
committed
- Fix it with AI ... (somehow)
1 parent e1bc3cd commit bb29c12

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

2026-02-05-Retro_Copilot/src/test/java/de/hilling/chess/ChessGameTest.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.hilling.chess;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertThrows;
45
import static org.junit.jupiter.api.Assertions.fail;
56

67
import 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

0 commit comments

Comments
 (0)