mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-11-04 11:43:44 +01:00 
			
		
		
		
	Fikser kodestil
This commit is contained in:
		@@ -14,7 +14,7 @@ public class BoardElementContainerTest {
 | 
			
		||||
        Position pos = new Position(1,2);
 | 
			
		||||
        Tile tile = new Tile(TileType.TILE, Direction.NORTH);
 | 
			
		||||
        BoardElementContainer<Tile> element = new BoardElementContainer<>(tile, pos);
 | 
			
		||||
        assertEquals(tile, element.getObject());
 | 
			
		||||
        assertEquals(tile, element.getElement());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@ public class BoardTest {
 | 
			
		||||
    private List<Robot> robotList;
 | 
			
		||||
    private Board board;
 | 
			
		||||
    private Board boardWithDifferentAmountOfAllTypes;
 | 
			
		||||
    private Map<WallType,Integer> wallTypeNumberMap = new HashMap<>();
 | 
			
		||||
    private Map<TileType,Integer> tileTypeNumberMap = new HashMap<>();
 | 
			
		||||
    private final Map<WallType,Integer> wallTypeNumberMap = new HashMap<>();
 | 
			
		||||
    private final Map<TileType,Integer> tileTypeNumberMap = new HashMap<>();
 | 
			
		||||
 | 
			
		||||
    @BeforeClass
 | 
			
		||||
    public static void globalSetUp() {
 | 
			
		||||
@@ -223,7 +223,7 @@ public class BoardTest {
 | 
			
		||||
        List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.COGWHEEL_LEFT);
 | 
			
		||||
 | 
			
		||||
        for (BoardElementContainer<Tile> elem : boardElemList) {
 | 
			
		||||
            assertEquals(elem.getObject().getTileType(), TileType.COGWHEEL_LEFT);
 | 
			
		||||
            assertEquals(elem.getElement().getTileType(), TileType.COGWHEEL_LEFT);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -238,7 +238,7 @@ public class BoardTest {
 | 
			
		||||
        List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.TILE);
 | 
			
		||||
 | 
			
		||||
        for (BoardElementContainer<Tile> elem : boardElemList) {
 | 
			
		||||
            assertEquals(elem.getObject().getTileType(), TileType.TILE);
 | 
			
		||||
            assertEquals(elem.getElement().getTileType(), TileType.TILE);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -253,7 +253,7 @@ public class BoardTest {
 | 
			
		||||
        List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_NORMAL);
 | 
			
		||||
 | 
			
		||||
        for (BoardElementContainer<Wall> elem : boardElemList) {
 | 
			
		||||
            assertEquals(elem.getObject().getWallType(), WallType.WALL_NORMAL);
 | 
			
		||||
            assertEquals(elem.getElement().getWallType(), WallType.WALL_NORMAL);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -268,14 +268,14 @@ public class BoardTest {
 | 
			
		||||
        List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_CORNER);
 | 
			
		||||
 | 
			
		||||
        for (BoardElementContainer<Wall> elem : boardElemList) {
 | 
			
		||||
            assertEquals(elem.getObject().getWallType(), WallType.WALL_CORNER);
 | 
			
		||||
            assertEquals(elem.getElement().getWallType(), WallType.WALL_CORNER);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void getPositionsOfWallOnBoardHasCorrect() {
 | 
			
		||||
        List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_CORNER);
 | 
			
		||||
        Predicate<BoardElementContainer<Wall>> pred = (element) -> element.getObject().getWallType() == WallType.WALL_CORNER;
 | 
			
		||||
        Predicate<BoardElementContainer<Wall>> pred = (element) -> element.getElement().getWallType() == WallType.WALL_CORNER;
 | 
			
		||||
        boardElemList.removeIf(pred);
 | 
			
		||||
        assertEquals(0, boardElemList.size());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,12 +8,14 @@ import org.junit.Test;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.*;
 | 
			
		||||
import static org.junit.Assert.assertEquals;
 | 
			
		||||
import static org.junit.Assert.assertFalse;
 | 
			
		||||
import static org.junit.Assert.assertTrue;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public class PlayerTest {
 | 
			
		||||
    private Player playerTest;
 | 
			
		||||
    private List<ProgrammingCard> cards = new ArrayList();
 | 
			
		||||
    private final List<ProgrammingCard> cards = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void setUp() {
 | 
			
		||||
@@ -22,7 +24,6 @@ public class PlayerTest {
 | 
			
		||||
        cards.add(new ProgrammingCard(30, Action.MOVE_3));
 | 
			
		||||
        cards.add(new ProgrammingCard(40, Action.BACK_UP));
 | 
			
		||||
        cards.add(new ProgrammingCard(50, Action.ROTATE_LEFT));
 | 
			
		||||
        ProgrammingCardDeck playerDeck = new ProgrammingCardDeck(cards);
 | 
			
		||||
        playerTest = new Player(RobotID.ROBOT_1, "TestPlayer" );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -37,8 +38,9 @@ public class PlayerTest {
 | 
			
		||||
        playerTest.setPowerDownNextRound(false);
 | 
			
		||||
        assertFalse(playerTest.getPowerDownNextRound());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testSetInProgram(){
 | 
			
		||||
    public void testSetInProgram() {
 | 
			
		||||
        playerTest.setInProgram(cards);
 | 
			
		||||
        assertEquals(Action.MOVE_1, playerTest.getProgramFromPlayer().get(0).getAction());
 | 
			
		||||
        assertEquals(Action.MOVE_2, playerTest.getProgramFromPlayer().get(1).getAction());
 | 
			
		||||
@@ -47,13 +49,13 @@ public class PlayerTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test (expected = IllegalArgumentException.class)
 | 
			
		||||
    public void testSetInProgramWithToManyCards(){
 | 
			
		||||
    public void testSetInProgramWithToManyCards() {
 | 
			
		||||
        cards.add(new ProgrammingCard(10,Action.ROTATE_LEFT));
 | 
			
		||||
        playerTest.setInProgram(cards);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testSetInDeck(){
 | 
			
		||||
    public void testSetInDeck() {
 | 
			
		||||
        cards.add(new ProgrammingCard(10,Action.ROTATE_LEFT));
 | 
			
		||||
        ProgrammingCardDeck playerDeck = new ProgrammingCardDeck(cards);
 | 
			
		||||
        playerTest.setPlayerDeck(playerDeck);
 | 
			
		||||
@@ -61,17 +63,17 @@ public class PlayerTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void GetPlayerRobotId(){
 | 
			
		||||
    public void getPlayerRobotId() {
 | 
			
		||||
        assertEquals(RobotID.ROBOT_1, playerTest.getRobotID());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void GetPlayerName(){
 | 
			
		||||
    public void getPlayerName() {
 | 
			
		||||
        assertEquals("TestPlayer", playerTest.getName());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void GetProgramFromPlayer(){
 | 
			
		||||
    public void getProgramFromPlayer() {
 | 
			
		||||
        playerTest.setInProgram(cards);
 | 
			
		||||
        assertEquals(cards,playerTest.getProgram());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user