mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-09 03:29:35 +01:00
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
43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
package inf112.fiasko.roborally.objects;
|
|
|
|
import inf112.fiasko.roborally.element_properties.Direction;
|
|
import inf112.fiasko.roborally.element_properties.WallType;
|
|
|
|
/**
|
|
* This class represents a wall
|
|
*/
|
|
public class Wall {
|
|
|
|
private final WallType wallType;
|
|
private final Direction direction;
|
|
|
|
/**
|
|
* Initializes a wall
|
|
* @param wallType The type of the 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;
|
|
}
|
|
|
|
/**
|
|
* Gets the type of the wall
|
|
* @return The wall type
|
|
*/
|
|
public WallType getWallType() {
|
|
return wallType;
|
|
}
|
|
|
|
/**
|
|
* Gets the direction of the wall
|
|
* @return The direction of the wall
|
|
*/
|
|
public Direction getDirection(){
|
|
return direction;
|
|
}
|
|
}
|