From 20d73bd5e0876a24031b4ab6cbb511f04e18df56 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 10 Dec 2021 11:20:56 +0100 Subject: [PATCH] updated javaodoc SiedlerBoard --- src/ch/zhaw/catan/SiedlerBoard.java | 23 +++++++++++++---------- test/ch/zhaw/catan/SiedlerBoardTest.java | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index ce3ea15..adf84fb 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -25,7 +25,7 @@ public class SiedlerBoard extends HexBoard fields = new HashMap<>(); private Config.Faction longestRoadFaction = null; - private int longestRoadLenth = 0; + private int longestRoadLength = 0; /** * Method to create the predefined game field from Config. @@ -47,6 +47,15 @@ public class SiedlerBoard extends HexBoard longestRoadLenth && players.get(factionA) > 4) { + if (players.get(factionA) > longestRoadLength && players.get(factionA) > 4) { longestRoadFaction = factionA; - longestRoadLenth = players.get(factionA); + longestRoadLength = players.get(factionA); } } return longestRoadFaction; } - //todo javadoc - public int getLongestRoadLenth() { - return longestRoadLenth; - } - /** * This method is recursive and adds all roads which belongs to a specific players and stringing together to a HashSet. * The length of the HashSet represents the length of the longest Road the player has. diff --git a/test/ch/zhaw/catan/SiedlerBoardTest.java b/test/ch/zhaw/catan/SiedlerBoardTest.java index f083917..8452824 100644 --- a/test/ch/zhaw/catan/SiedlerBoardTest.java +++ b/test/ch/zhaw/catan/SiedlerBoardTest.java @@ -41,7 +41,7 @@ public class SiedlerBoardTest { System.out.println(board.getTextView()); assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList)); - assertEquals(6, board.getLongestRoadLenth()); + assertEquals(6, board.getLongestRoadLength()); } @Test @@ -50,7 +50,7 @@ public class SiedlerBoardTest { System.out.println(board.getTextView()); assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList)); - assertEquals(5, board.getLongestRoadLenth()); + assertEquals(5, board.getLongestRoadLength()); } }