forked from On-Time-Software-Developers/ConsoleGameHub-OSD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameUtilsTest.java
More file actions
30 lines (30 loc) · 1.01 KB
/
GameUtilsTest.java
File metadata and controls
30 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.List;
import java.util.Collections;
/**
* A collection of tests for the GameUtils class.
* @author Landry Vewenda
* @author Efream Fsahaye
*/
public class GameUtilsTest {
@Test
void testValidNonEmptyListOfWords() {
List<String> words = Arrays.asList("java", "python", "kotlin");
String selectedWord = GameUtils.getRandomWord(words);
assertTrue(words.contains(selectedWord));
}
@Test
void testEmptyListOfWords() {
List<String> words = Collections.emptyList();
String selectedWord = GameUtils.getRandomWord(words);
assertNull(selectedWord);
}
@Test
void testListWithNull() {
String selectedWord = GameUtils.getRandomWord(null);
assertNull(selectedWord);
}
}