Legger til manglende sjekking av retning for en vegg som instansieres

Legger til en test som sjekker at en exception blir kastet når en ugyldig vegg blir forsøkt instansiert
Legger til en test som sjekker at en exception blir kastet når en ugyldig tile blir forsøkt instansiert
This commit is contained in:
2020-03-02 13:26:42 +01:00
parent d7186d38c3
commit c6083c2a70
3 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,9 @@ public class Wall {
* @param direction The direction of the wall
*/
public Wall (WallType wallType, Direction direction) {
if (direction.getDirectionID() % 2 == 0 && wallType != WallType.WALL_CORNER) {
throw new IllegalArgumentException("Invalid direction for wall type submitted");
}
this.wallType = wallType;
this.direction = direction;
}