From fd48cf5f7a81582f01d0683d024b7f971d06134b Mon Sep 17 00:00:00 2001 From: Petter Tobias Madsen Date: Thu, 20 Feb 2020 10:50:57 +0100 Subject: [PATCH 1/3] Tobias og Gabriel lagde en Wall klass og testet den --- .../roborally/element_properties/Wall.java | 23 ++++++++++++++ .../inf112/fiasko/roborally/TestWall.java | 31 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/main/java/inf112/fiasko/roborally/element_properties/Wall.java create mode 100644 src/test/java/inf112/fiasko/roborally/TestWall.java diff --git a/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java b/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java new file mode 100644 index 0000000..a6d27a9 --- /dev/null +++ b/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java @@ -0,0 +1,23 @@ +package inf112.fiasko.roborally.element_properties; + +public class Wall { + private WallType wall; + private Direction direction; + + public Wall (WallType wall,Direction direction){ + this.wall = wall; + this.direction = direction; + } + + public WallType getWallType() { + return wall; + } + + public Direction getDirection(){ + return direction; + } + + + + +} diff --git a/src/test/java/inf112/fiasko/roborally/TestWall.java b/src/test/java/inf112/fiasko/roborally/TestWall.java new file mode 100644 index 0000000..837e44e --- /dev/null +++ b/src/test/java/inf112/fiasko/roborally/TestWall.java @@ -0,0 +1,31 @@ +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 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()); + } + +} From 0ee705252b145e463661d7e96224011ce0ce7cf3 Mon Sep 17 00:00:00 2001 From: Petter Tobias Madsen Date: Thu, 20 Feb 2020 10:59:11 +0100 Subject: [PATCH 2/3] Tobias og Gabriel added comments to the wall class --- .../roborally/element_properties/Wall.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java b/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java index a6d27a9..fb8c8be 100644 --- a/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java +++ b/src/main/java/inf112/fiasko/roborally/element_properties/Wall.java @@ -1,18 +1,34 @@ 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; } From 54c15dcbac236951ed3ee43911f44016531ddb8c Mon Sep 17 00:00:00 2001 From: Petter Tobias Madsen Date: Thu, 20 Feb 2020 11:04:16 +0100 Subject: [PATCH 3/3] Tobias og Gabriel added extra test to wall class --- src/test/java/inf112/fiasko/roborally/TestWall.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/inf112/fiasko/roborally/TestWall.java b/src/test/java/inf112/fiasko/roborally/TestWall.java index 837e44e..c94ec6a 100644 --- a/src/test/java/inf112/fiasko/roborally/TestWall.java +++ b/src/test/java/inf112/fiasko/roborally/TestWall.java @@ -18,6 +18,11 @@ public class TestWall { 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());