This commit is contained in:
2020-02-27 17:16:40 +01:00
6 changed files with 42 additions and 17 deletions

View File

@ -1,23 +1,46 @@
package inf112.fiasko.roborally.element_properties;
import inf112.fiasko.roborally.element_properties.Position;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
public class PositionTest {
private Position testPosition;
private Position testPosition1;
private Position testPosition2;
private Position testPosition3;
private Position testPosition4;
private Position testPosition5;
private Position testPosition6;
@Before
public void setUp() {
testPosition = new Position(3, 4);
testPosition1 = new Position(3, 4);
testPosition2 = new Position(2, 3);
testPosition3 = new Position(3, 4);
testPosition4 = new Position(3, 3);
testPosition5 = new Position(1, 4);
testPosition6 = new Position(3, 3);
}
@Test
public void testGetXPosition(){
assertEquals(3,testPosition.getXCoordinate());
assertEquals(3,testPosition1.getXCoordinate());
}
@Test
public void testGetYPosition(){
assertEquals(4,testPosition.getYCoordinate());
assertEquals(4,testPosition1.getYCoordinate());
}
@Test
public void testSamePositionsAreEqual() { assertEquals(testPosition1, testPosition3);}
@Test
public void testDifferentPositionsAreNotEqual() { assertNotEquals(testPosition2, testPosition4);}
@Test
public void equalXandDifferentYIsNotEqual() { assertNotEquals(testPosition1, testPosition6);}
@Test
public void equalYandDifferentXIsNotEqual() { assertNotEquals(testPosition1, testPosition5);}
}

View File

@ -1,6 +1,5 @@
package inf112.fiasko.roborally.element_properties;
import inf112.fiasko.roborally.element_properties.TileType;
import org.junit.Test;
import java.util.ArrayList;

View File

@ -1,7 +1,5 @@
package inf112.fiasko.roborally.element_properties;
import inf112.fiasko.roborally.element_properties.TileType;
import inf112.fiasko.roborally.element_properties.WallType;
import org.junit.Test;
import java.util.ArrayList;

View File

@ -1,7 +1,6 @@
package inf112.fiasko.roborally.objects;
import inf112.fiasko.roborally.element_properties.Direction;
import inf112.fiasko.roborally.objects.Wall;
import inf112.fiasko.roborally.element_properties.WallType;
import static org.junit.Assert.assertEquals;
import org.junit.Test;