-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathYourPlayerTest.java
More file actions
50 lines (35 loc) · 1.37 KB
/
YourPlayerTest.java
File metadata and controls
50 lines (35 loc) · 1.37 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
49
50
package com.hangman.players;
import org.junit.Test;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class YourPlayerTest {
List<Character> vowels = new LinkedList<Character>(Arrays.asList('a', 'e', 'i', 'o', 'u'));
@Test
public void DoesNotGuessAlreadyValidLetter() {
YourPlayer player = new YourPlayer();
char guess = player.GetGuess(Arrays.asList('_', '_', 'a'));
assertNotEquals('a', guess);
}
@Test
public void DoesNotGuessSameLetterTwice() {
YourPlayer player = new YourPlayer();
char firstGuess = player.GetGuess(Arrays.asList('_', '_', '_'));
char secondGuess = player.GetGuess(Arrays.asList('_', '_', firstGuess));
assertNotEquals(firstGuess, secondGuess);
}
@Test
public void GuessVowelsFirst() {
YourPlayer player = new YourPlayer();
char firstGuess = player.GetGuess(Arrays.asList('_', '_', '_', '_', '_'));
assertEquals(true, vowels.contains(firstGuess));
}
@Test
public void GuessesConsonantAfterTwoCorrectVowels() {
YourPlayer player = new YourPlayer();
char nextGuess = player.GetGuess(Arrays.asList('_', 'a', 'i', '_', '_', '_'));
assertEquals(false, vowels.contains(nextGuess));
}
}