Merge remote-tracking branch 'origin/master'

This commit is contained in:
Kristian Knarvik 2020-03-17 14:25:03 +01:00
commit 979265c592
2 changed files with 44 additions and 21 deletions

View File

@ -0,0 +1,17 @@
## Oppmøte
Tilstede: Steinar, Gabriel, Kristian, Torbjørn, Petter
Ikke tilstede:
## Agenda
- Design valg
- Brukerhistorier
- Fordele Oppgaver
## Møte
- Diskuterer spørmsål vi vil sende inn the "kunden" angående innlevering/vurdering.
- Sett på og reflektert rundt multiplayer finksjonaliteten.
- Prøvd å få gruppen på samme nivå abgående forståelse rundt utfordringer med nettverk.

View File

@ -221,10 +221,7 @@ public class BoardTest {
@Test @Test
public void getPositionsOfTileOnBoardHasTypeCogwheelLeft() { public void getPositionsOfTileOnBoardHasTypeCogwheelLeft() {
List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.COGWHEEL_LEFT); List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.COGWHEEL_LEFT);
assertTrue(checkIfAllElementsAreOfSpecificTileType(boardElemList, TileType.COGWHEEL_LEFT));
for (BoardElementContainer<Tile> elem : boardElemList) {
assertEquals(elem.getElement().getTileType(), TileType.COGWHEEL_LEFT);
}
} }
@Test @Test
@ -236,10 +233,7 @@ public class BoardTest {
@Test @Test
public void getPositionsOfTileOnBoardHasTypeTile() { public void getPositionsOfTileOnBoardHasTypeTile() {
List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.TILE); List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.TILE);
assertTrue(checkIfAllElementsAreOfSpecificTileType(boardElemList, TileType.TILE));
for (BoardElementContainer<Tile> elem : boardElemList) {
assertEquals(elem.getElement().getTileType(), TileType.TILE);
}
} }
@Test @Test
@ -251,10 +245,7 @@ public class BoardTest {
@Test @Test
public void getPositionsOfWallOnBoardHasTypeWallNormal() { public void getPositionsOfWallOnBoardHasTypeWallNormal() {
List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_NORMAL); List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_NORMAL);
assertTrue(checkIfAllElementsAreOfSpecificWallType(boardElemList, WallType.WALL_NORMAL));
for (BoardElementContainer<Wall> elem : boardElemList) {
assertEquals(elem.getElement().getWallType(), WallType.WALL_NORMAL);
}
} }
@Test @Test
@ -266,17 +257,32 @@ public class BoardTest {
@Test @Test
public void getPositionsOfWallOnBoardHasTypeWallCorner() { public void getPositionsOfWallOnBoardHasTypeWallCorner() {
List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_CORNER); List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_CORNER);
assertTrue(checkIfAllElementsAreOfSpecificWallType(boardElemList, WallType.WALL_CORNER));
for (BoardElementContainer<Wall> elem : boardElemList) {
assertEquals(elem.getElement().getWallType(), WallType.WALL_CORNER);
}
} }
@Test @Test
public void getPositionsOfWallOnBoardHasCorrect() { public void getPositionsOfWallOnBoardHasCorrectTypesWithMultipleParameters() {
List<BoardElementContainer<Wall>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfWallOnBoard(WallType.WALL_CORNER); List<BoardElementContainer<Tile>> boardElemList = boardWithDifferentAmountOfAllTypes.getPositionsOfTileOnBoard(TileType.COGWHEEL_LEFT, TileType.COGWHEEL_RIGHT);
Predicate<BoardElementContainer<Wall>> pred = (element) -> element.getElement().getWallType() == WallType.WALL_CORNER; List<TileType> tileTypeList = new ArrayList<>();
boardElemList.removeIf(pred); List<TileType> tileTypeListResult = new ArrayList<>();
assertEquals(0, boardElemList.size()); tileTypeList.add(TileType.COGWHEEL_LEFT);
tileTypeList.add(TileType.COGWHEEL_RIGHT);
for (BoardElementContainer<Tile> elem : boardElemList) {
tileTypeListResult.add(elem.getElement().getTileType());
}
assertTrue(tileTypeList.containsAll(tileTypeListResult) && tileTypeListResult.containsAll(tileTypeList));
}
public <K> boolean checkIfAllElementsAreOfSpecificWallType(List<BoardElementContainer<Wall>> elemList, K WallType) {
Predicate<BoardElementContainer<Wall>> pred = (element) -> element.getElement().getWallType() == WallType;
elemList.removeIf(pred);
return 0 == elemList.size();
}
public <K> boolean checkIfAllElementsAreOfSpecificTileType(List<BoardElementContainer<Tile>> elemList, K TileType) {
Predicate<BoardElementContainer<Tile>> pred = (element) -> element.getElement().getTileType() == TileType;
elemList.removeIf(pred);
return 0 == elemList.size();
} }
} }