-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathYourPlayerTest.java
More file actions
48 lines (39 loc) · 1.28 KB
/
YourPlayerTest.java
File metadata and controls
48 lines (39 loc) · 1.28 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
45
46
47
48
package com.hangman.players;
import org.junit.*;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
import com.hangman.Player;
public class YourPlayerTest {
Player player;
@Before
public void setup() {
player = new YourPlayer();
}
@Test
public void GuessesAWhenThereAreNoSuccessfulCharactersGuessedYet() {
char guess = player.GetGuess(Arrays.asList('_', '_', '_'));
assertEquals('a', guess);
}
// @Test
// public void GuessesAWhenThereAreSuccessfulCharactersGuessedThatAreNotA() {
//
// char guess = player.GetGuess(Arrays.asList('m', '_', 'n'));
//
// assertEquals('a', guess);
// }
@Test
public void ShouldTryAllVowelsWhenNoMatch() {
List<Character> noMatch = Arrays.asList('_', '_', '_');
assertEquals('a', player.GetGuess(noMatch));
assertEquals('e', player.GetGuess(noMatch));
assertEquals('i', player.GetGuess(noMatch));
assertEquals('o', player.GetGuess(noMatch));
assertEquals('u', player.GetGuess(noMatch));
}
@Test
public void ShouldTryConsonentsWhenTwoMatches() {
List<Character> noMatch = Arrays.asList('_', 'a', '_', 'o', '_');
assertEquals('s', player.GetGuess(noMatch));
}
}