-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathYourPlayerTest.java
More file actions
44 lines (32 loc) · 1.12 KB
/
YourPlayerTest.java
File metadata and controls
44 lines (32 loc) · 1.12 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.hangman.players;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class YourPlayerTest {
@Test
public void GuessesAWhenThereAreNoSuccessfulCharactersGuessedYet() {
YourPlayer player = new YourPlayer();
List<Character> allChars = new ArrayList<>();
char guess = player.GetGuess(Arrays.asList('_', '_', '_'));
for (int i = 0; i < 26; i++){
char c = (char) (i+ 'a');
allChars.add(c);
}
assertTrue(allChars.contains(guess));
}
@Test
public void GuessesAWhenThereAreSuccessfulCharactersGuessedThatAreNotA() {
YourPlayer player = new YourPlayer();
char guess = player.GetGuess(Arrays.asList('m', '_', 'n'));
assertEquals('a', guess);
}
@Test
public void GuessesAWhenAIsThereAreAsInTheClueAsWell() {
YourPlayer player = new YourPlayer();
char guess = player.GetGuess(Arrays.asList('_', 'a', '_'));
assertEquals('a', guess);
}
}