EpicKnarvik97 c6083c2a70 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
2020-03-02 13:26:42 +01:00

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;
}
}