update testLongestRoad

This commit is contained in:
schrom01 2021-12-10 09:12:16 +01:00
parent 3b721301fa
commit bf512128f7
1 changed files with 38 additions and 18 deletions

View File

@ -31,15 +31,19 @@ public class SiedlerGameTest {
@DisplayName("Positive test cases") @DisplayName("Positive test cases")
class PositiveTestcases { class PositiveTestcases {
@Nested
class LongestRoadTest {
/** /**
* To Test getLongestRoad in SiedlerBoard * To Test getLongestRoad in SiedlerBoard
*
*/ */
@Test
public void testLongestRoad() {
List<Config.Faction> factionList = Arrays.asList(Config.Faction.values()); List<Config.Faction> factionList = Arrays.asList(Config.Faction.values());
SiedlerBoard board = new SiedlerBoard(); SiedlerBoard board = new SiedlerBoard();
@BeforeEach
public void buildLongestRoad(){
board.createFixGameField(); 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))); board.setEdge(new Point(6, 6), new Point(5, 7), new Road(Config.Faction.BLUE, new Point(6, 6), new Point(5, 7)));
board.setEdge(new Point(4, 6), new Point(5, 7), new Road(Config.Faction.BLUE, new Point(4, 6), new Point(5, 7))); board.setEdge(new Point(4, 6), new Point(5, 7), new Road(Config.Faction.BLUE, new Point(4, 6), new Point(5, 7)));
@ -49,9 +53,25 @@ 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(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.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))); board.setCorner(new Point(3, 7), new Settlement(Config.Faction.BLUE, new Point(3, 7)));
}
@Test
public void testLongestRoadSimple() {
System.out.println(board.getTextView());
assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList)); assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList));
assertEquals(6, board.getLongestRoadLenth()); assertEquals(6, board.getLongestRoadLenth());
//todo prüfen ob länge Stimmt. }
@Test
public void testLongestRoadWithInterrupt() {
board.setCorner(new Point(4, 10), new Settlement(Config.Faction.RED, new Point(4, 10)));
System.out.println(board.getTextView());
assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList));
assertEquals(5, board.getLongestRoadLenth());
}
} }
/** /**