mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Tobias og Kristian lagde en Position class. og begynnte på testene for classen
This commit is contained in:
parent
8b30c8967f
commit
470b1bcbd8
33
src/main/java/inf112/fiasko/roborally/game/Position.java
Normal file
33
src/main/java/inf112/fiasko/roborally/game/Position.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package inf112.fiasko.roborally.game;
|
||||||
|
|
||||||
|
public class Position {
|
||||||
|
|
||||||
|
private int xPosition;
|
||||||
|
private int yPosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initalises the x and y cooardinats.
|
||||||
|
* @param xPosition sets the x position.
|
||||||
|
* @param yPosition sets the y position.
|
||||||
|
*/
|
||||||
|
public Position(int xPosition, int yPosition) {
|
||||||
|
this.xPosition = xPosition;
|
||||||
|
this.yPosition = yPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets x coordinate of the position.
|
||||||
|
* @return the x coordinate of the position.
|
||||||
|
*/
|
||||||
|
public int getXCoordinate() {
|
||||||
|
return xPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets y coordinate of the position.
|
||||||
|
* @return the y coordinate of the position.
|
||||||
|
*/
|
||||||
|
public int getYCoordinate() {
|
||||||
|
return yPosition;
|
||||||
|
}
|
||||||
|
}
|
15
src/test/java/inf112/fiasko/roborally/PositionTest.java
Normal file
15
src/test/java/inf112/fiasko/roborally/PositionTest.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package inf112.fiasko.roborally;
|
||||||
|
|
||||||
|
import inf112.fiasko.roborally.game.Position;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class PositionTest {
|
||||||
|
@Test
|
||||||
|
public void TestGetXPosition(){
|
||||||
|
Position testXPosition = new Position(3,4);
|
||||||
|
assertEquals(3,testXPosition.getXCoordinate());
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user