refactored longestRoad implementation from SiedlerGame to SiedlerBoard and updated Test Method longestRoad
This commit is contained in:
@@ -13,9 +13,8 @@ import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/***
|
||||
@@ -50,18 +49,15 @@ public class SiedlerGameTest {
|
||||
));
|
||||
|
||||
/**
|
||||
* To Test getLongestRoad in SiedlerGame isolatet do:
|
||||
* 1. make SiedlerGame.getLongestRoadFaction, Siedlergame.countRoad && Siedlergame.getNextPoint static
|
||||
* 2. make SiedlerGame.getLongestRoadFaction public
|
||||
* 3. add Parameter Board to SiedlerGame.getLongestRoadFaction and SiedlerGame.countRoad.
|
||||
* 4. add Parameter faction to SiedlerGame.getLongestRoadFaction
|
||||
* 5. Create Board in testLongestRoad() and Hashmap with faction
|
||||
* Tipp: Logic Equivalent classes are: start counting at settlements with 0 or 1 or 2 or 3 own roads attached to it
|
||||
* Make branches in between the road with diffrent lengths.
|
||||
* To Test getLongestRoad in SiedlerBoard
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testLongestRoad() {
|
||||
HashMap<Config.Faction,Integer> currentLongestRoad = new HashMap<>();
|
||||
//currentLongestRoad.put(Config.Faction.RED,5);
|
||||
List<Config.Faction> factionList = Arrays.asList(Config.Faction.values());
|
||||
|
||||
SiedlerBoard board = new SiedlerBoard();
|
||||
board.createFixGamefield();
|
||||
board.setEdge(new Point(6, 6), new Point(5, 7), new Road(Config.Faction.BLUE,new Point(6, 6),new Point(5, 7)));
|
||||
@@ -72,7 +68,9 @@ public class SiedlerGameTest {
|
||||
board.setEdge(new Point(3, 9), new Point(4, 10), new Road(Config.Faction.BLUE,new Point(3, 9),new Point(4, 10)));
|
||||
board.setEdge(new Point(4, 10), new Point(5, 9), new Road(Config.Faction.BLUE,new Point(4, 10),new Point(5, 9)));
|
||||
board.setCorner(new Point(3,7),new Settlement(Config.Faction.BLUE,new Point(3,7)));
|
||||
//SiedlerGame.getLongestRoadFaction(board,faction);
|
||||
board.getLongestRoadFaction(currentLongestRoad,factionList);
|
||||
assertEquals(6,currentLongestRoad.get(Config.Faction.BLUE));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user