mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
183ba4e507
@ -0,0 +1,39 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
public class Wall {
|
||||
/**
|
||||
* This class is a representation of a wall
|
||||
*/
|
||||
private WallType wall;
|
||||
private Direction direction;
|
||||
|
||||
/**
|
||||
* Initializes the wall
|
||||
* @param wall gives the type of wall eks. wall normal or wall corner
|
||||
* @param direction gives the direction the wall is facing.
|
||||
*/
|
||||
public Wall (WallType wall,Direction direction){
|
||||
this.wall = wall;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the wall
|
||||
* @return the wall type
|
||||
*/
|
||||
public WallType getWallType() {
|
||||
return wall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the direction of the wall
|
||||
* @return the direction of the wall
|
||||
*/
|
||||
public Direction getDirection(){
|
||||
return direction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
36
src/test/java/inf112/fiasko/roborally/TestWall.java
Normal file
36
src/test/java/inf112/fiasko/roborally/TestWall.java
Normal file
@ -0,0 +1,36 @@
|
||||
package inf112.fiasko.roborally;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import inf112.fiasko.roborally.element_properties.Wall;
|
||||
import inf112.fiasko.roborally.element_properties.WallType;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestWall {
|
||||
@Test
|
||||
public void testWallGetWallTypeNormal(){
|
||||
Wall testGetWall = new Wall(WallType.WALL_NORMAL, Direction.NORTH);
|
||||
assertEquals(WallType.WALL_NORMAL, testGetWall.getWallType());
|
||||
}
|
||||
@Test
|
||||
public void testWallGetWallTypeCorner(){
|
||||
Wall testGetWall = new Wall(WallType.WALL_CORNER, Direction.NORTH);
|
||||
assertEquals(WallType.WALL_CORNER, testGetWall.getWallType());
|
||||
}
|
||||
@Test
|
||||
public void testWallGetWallTypeLaserSingle(){
|
||||
Wall testGetWall = new Wall(WallType.WALL_LASER_SINGLE, Direction.NORTH);
|
||||
assertEquals(WallType.WALL_LASER_SINGLE, testGetWall.getWallType());
|
||||
}
|
||||
@Test
|
||||
public void testWallGetDirectionNorth(){
|
||||
Wall testGetWall = new Wall(WallType.WALL_CORNER, Direction.NORTH);
|
||||
assertEquals(Direction.NORTH, testGetWall.getDirection());
|
||||
}
|
||||
@Test
|
||||
public void testWallGetDirectionEast(){
|
||||
Wall testGetWall = new Wall(WallType.WALL_CORNER, Direction.EAST);
|
||||
assertEquals(Direction.EAST, testGetWall.getDirection());
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user