mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-11-04 03:33:45 +01:00 
			
		
		
		
	Made tests for the position.equals method.
This commit is contained in:
		@@ -1,23 +1,35 @@
 | 
			
		||||
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;
 | 
			
		||||
    @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);
 | 
			
		||||
    }
 | 
			
		||||
    @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);}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user