diff --git a/src/test/java/uta/cse3310/GameTest.java b/src/test/java/uta/cse3310/GameTest.java index f671fa0..9dcabc1 100644 --- a/src/test/java/uta/cse3310/GameTest.java +++ b/src/test/java/uta/cse3310/GameTest.java @@ -1,14 +1,16 @@ package uta.cse3310; import junit.framework.TestCase; import java.util.Arrays; +import java.util.Random; public class GameTest extends TestCase { private Game game; public void setUp() { + Random fixedRandom = new Random(42); + game = new Game("testWords.txt" ,5, 10, fixedRandom); + game.fillWithwords(); - game = new Game("dummyPath", 5, 10); - game.initializeMatrix(); } public void testMatrixInitialization() { @@ -22,12 +24,12 @@ public void testMatrixInitialization() { public void testWordPlacement() { - game.placeWords(); + game.fillWithwords(); assertTrue("Expected at least one word to be placed", game.getNumofWords() > 0); } public void testFillRandom() { - game.fillRandom(); + game.fillWithrandom(); char[][] matrix = game.getMatrix(); boolean hasRandomLetters = false; for (int i = 0; i < matrix.length; i++) { @@ -41,9 +43,5 @@ public void testFillRandom() { assertTrue("Matrix should contain random letters", hasRandomLetters); } - public void testCheckAnswer() { - - assertTrue("Word should be found at the specified coordinates", game.check_ans(0, 0, 0, 3)); - assertFalse("No word should match these coordinates", game.check_ans(0, 0, 5, 5)); - } + }