-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRPSArenaTest.java
More file actions
85 lines (73 loc) · 2.61 KB
/
RPSArenaTest.java
File metadata and controls
85 lines (73 loc) · 2.61 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import java.util.LinkedHashMap;
/**
* Lab
*
* Test suite for the RPSArena class.
*
* @author Stephen
* @version 2018-03-12
*
*/
public class RPSArenaTest {
/**
* The RPSArena instance to test.
*/
private static RPSArena arena;
/**
* Creates a RPSArena instance for testing.
*/
public static void initialize() throws AssertException
{
arena = new RPSArena();
}
/**
* Tests the constructor and the contestant lists
*/
public void testContestantList() throws AssertException {
Assert.assertEquals(Contestant.GEORGE, arena.getContestant("GEO"));
Assert.assertEquals(Contestant.JILL, arena.getContestant("JIL"));
Assert.assertEquals(Contestant.MATTHEW, arena.getContestant("MAT"));
Assert.assertEquals(Contestant.BETTY, arena.getContestant("BET"));
}
/**
* Tests getting the abbreviations.
*/
public void testContestantAbbreviations() throws AssertException {
Assert.assertEquals("[GEO, JIL, MAT, BET]", arena.getContestantAbbreivations().toString());
}
/**
* Tests getting the contestants that exist in the map.
*/
public void testGetContestantExists() throws AssertException {
Assert.assertEquals(Contestant.GEORGE, arena.getContestant("GEO"));
Assert.assertEquals(Contestant.JILL, arena.getContestant("JIL"));
Assert.assertEquals(Contestant.MATTHEW, arena.getContestant("MAT"));
Assert.assertEquals(Contestant.BETTY, arena.getContestant("BET"));
}
/**
* Tests getting a contestant that does not exist in the map.
* Note: there is an assertNull method within Assert.java you can use
*/
public void testGetContestantDoesNotExist() throws AssertException {
Assert.assertNull(arena.getContestant("JAC"));
}
/**
* Tests a contestant battle ending in a tie.
* Note: there is an assertNull method within Assert.java you can use
*/
public void testContestantBattleTie() throws AssertException {
Assert.assertNull(RPSArena.battleContestants(Contestant.GEORGE, Contestant.JILL));
}
/**
* Tests a contestant battle ending in George winning.
*/
public void testContestantBattleGeorgeWins() throws AssertException {
Assert.assertEquals(Contestant.GEORGE, RPSArena.battleContestants(Contestant.GEORGE, Contestant.MATTHEW));
}
/**
* Tests a contestant battle ending in Betty winning.
*/
public void testContestantBattleBettyWins() throws AssertException {
Assert.assertEquals(Contestant.BETTY, RPSArena.battleContestants(Contestant.BETTY, Contestant.GEORGE));
}
}