Merge remote-tracking branch 'origin/main'

This commit is contained in:
schrom01 2021-12-10 11:47:26 +01:00
commit 470666ed75
3 changed files with 38 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View File

@ -12,11 +12,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class SiedlerBoardTest { public class SiedlerBoardTest {
@Nested
class LongestRoadTest {
/** /**
* To Test getLongestRoad in SiedlerBoard * To Test getLongestRoad in SiedlerBoard
*/ */
@Nested
class LongestRoadTest {
List<Config.Faction> factionList = Arrays.asList(Config.Faction.values()); List<Config.Faction> factionList = Arrays.asList(Config.Faction.values());

View File

@ -20,7 +20,21 @@ import java.util.List;
* *
*/ */
/**
* @class SiedlerGameTest
*
* contains all of the test cases for SiedlerGame class.
* The Test cases are categorized into
* - Positive TestCases
* Tests the methods of SiedlerGame with the intended values
*
* - Negative TestCases
* Tests the methods of SiedlerGame with values, that results to errors and failure
*
* - SystemTestCases
* Tests the coordination of all methods and simulates a game with all moves programmed
* Checks if the methods are being executed and the values are set correctly
*/
public class SiedlerGameTest { public class SiedlerGameTest {
private final static int DEFAULT_WINPOINTS = 5; private final static int DEFAULT_WINPOINTS = 5;
@ -40,7 +54,7 @@ public class SiedlerGameTest {
); );
/** /**
* START_ROADS_POSITION * Property START_ROADS_POSITION
* *
* Lists all endpoints of roads for every faction in the initialization phase. * Lists all endpoints of roads for every faction in the initialization phase.
* Each faction is assigned to a specific Road, which represents as a tuple of 2 points * Each faction is assigned to a specific Road, which represents as a tuple of 2 points
@ -92,16 +106,15 @@ public class SiedlerGameTest {
@Test @Test
@DisplayName("Test") @DisplayName("Test")
public void TestHandle7() { public void TestHandle7() {
SiedlerGame game = startGame(); SiedlerGame game = startGame();
} }
} }
/** /**
* @Class NegtiveTestcases * @Class NegAtiveTestcases
* *
* This class contains all negative test cases * contains all negative test cases
*/ */
@Nested @Nested
@DisplayName("Negative test cases") @DisplayName("Negative test cases")
@ -190,7 +203,7 @@ public class SiedlerGameTest {
class SystemTestcases { class SystemTestcases {
/** /**
* This will test if the players can place initial settlements and roads * TestS if the players can place initial settlements and roads
*/ */
@Test @Test
@DisplayName("2 Players initialize a settlement and position") @DisplayName("2 Players initialize a settlement and position")
@ -217,6 +230,18 @@ public class SiedlerGameTest {
SiedlerGame game = gameAfterSetupPhase(); SiedlerGame game = gameAfterSetupPhase();
throwDiceSeveralTimes(game, 5, 5); throwDiceSeveralTimes(game, 5, 5);
throwDiceSeveralTimes(game, 5, 5);
throwDiceSeveralTimes(game, 5, 5);
throwDiceSeveralTimes(game, 5, 5);
throwDiceSeveralTimes(game, 5, 5);
game.switchToNextPlayer();
throwDiceSeveralTimes(game, 6, 5);
//throwDiceSeveralTimes(game, 6, 5);
//throwDiceSeveralTimes(game, 6, 5);
//throwDiceSeveralTimes(game, 6, 5);
//throwDiceSeveralTimes(game, 6, 5);
soutDistribution(game); soutDistribution(game);
} }
@ -295,8 +320,10 @@ public class SiedlerGameTest {
* @param amountDiceThrows Type int, The amount of dice throws * @param amountDiceThrows Type int, The amount of dice throws
*/ */
private static void throwDiceSeveralTimes(SiedlerGame game, int dice, int amountDiceThrows) { private static void throwDiceSeveralTimes(SiedlerGame game, int dice, int amountDiceThrows) {
//System.out.println(game.getCurrentPlayerFaction().toString() + " got " + dice + " and throw " + amountDiceThrows + " times");
for (int i = 0; i < amountDiceThrows; i++) { for (int i = 0; i < amountDiceThrows; i++) {
System.out.println(game.getCurrentPlayerFaction().toString());
game.throwDice(dice); game.throwDice(dice);
} }
} }