-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathYourPlayerTest.java
More file actions
35 lines (25 loc) · 971 Bytes
/
YourPlayerTest.java
File metadata and controls
35 lines (25 loc) · 971 Bytes
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
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.assertNotEquals;
public class YourPlayerTest {
@Test
public void guessesAWhenThereAreNoSuccessfulCharactersGuessedYet() {
YourPlayer player = new YourPlayer();
char guess = player.getGuess(Arrays.asList(null, null, null));
assertEquals('e', guess);
}
@Test
public void guessesLetterNotInCurrentClueList() {
YourPlayer player = new YourPlayer();
char guess = player.getGuess(Arrays.asList('m', null, 'n'));
boolean guessNotInList = assertGuessNotInList(guess, Arrays.asList('m', null, 'n'));
assertEquals(true, guessNotInList);
}
static boolean assertGuessNotInList(char guess, List<Character> currentClueList) {
return (!(currentClueList.contains(guess)));
}
}