-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create TestGameDifficultyListItem.java
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package kakuro; | ||
|
||
//@author Nalveer Moocheet | ||
//@brief Test for the GameDifficultyListItem | ||
|
||
|
||
import static org.junit.Assert.assertEquals; | ||
import org.junit.Test; | ||
import kakuro.core.GameDifficulty; | ||
import kakuro.core.GameDifficultyListItem; | ||
|
||
|
||
public class TestGameDifficultyListItem { | ||
|
||
|
||
//this function tests the constructor of GameDifficultyListItem | ||
@Test | ||
public void testConstructorOfTestGameDifficultyListItem() { | ||
|
||
//Arrange | ||
String description = "Difficult Game"; | ||
GameDifficulty gameDiff = GameDifficulty.DIFFICULT; | ||
|
||
//Act | ||
GameDifficultyListItem obj = new GameDifficultyListItem(description,gameDiff); | ||
|
||
//Assert | ||
assertEquals(obj.getDifficulty(),gameDiff); | ||
assertEquals(obj.toString(),description); | ||
|
||
|
||
|
||
} | ||
|
||
//this function test the toString method | ||
@Test | ||
public void testToString() { | ||
|
||
//Arrange | ||
String description = "Easy Game"; | ||
GameDifficulty gameDiff = GameDifficulty.EASY; | ||
GameDifficultyListItem obj = new GameDifficultyListItem(description,gameDiff); | ||
|
||
//Act | ||
String toString = obj.toString(); | ||
|
||
//Assert | ||
assertEquals(toString, description); | ||
|
||
|
||
} | ||
|
||
//this function tests the getDifficulty method | ||
@Test | ||
public void testGetDifficulty() { | ||
|
||
//Arrange | ||
String description = "Medium Game"; | ||
GameDifficulty gameDiff = GameDifficulty.MEDIUM; | ||
GameDifficultyListItem obj = new GameDifficultyListItem(description,gameDiff); | ||
|
||
//Act | ||
GameDifficulty difficulty= obj.getDifficulty(); | ||
|
||
//Assert | ||
assertEquals(difficulty, gameDiff); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |