-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeamEventTest.java
More file actions
59 lines (43 loc) · 1.46 KB
/
TeamEventTest.java
File metadata and controls
59 lines (43 loc) · 1.46 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
package WID_Classes;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class TeamEventTest {
@Test
public void testAddScore() {
TeamEvent event = new TeamEvent("Soccer");
List<Participant> team = new ArrayList<>();
team.add(new Participant("John"));
team.add(new Participant("Jane"));
team.add(new Participant("Bob"));
event.addScore(team, 2,0);
event.addScore(team, 3,1);
event.addScore(team, 1,2);
assertEquals(6, event.getScore(team));
}
@Test
public void testGetScore() {
TeamEvent event = new TeamEvent("Basketball");
List<Participant> team = new ArrayList<>();
team.add(new Participant("Alice"));
team.add(new Participant("David"));
team.add(new Participant("Emily"));
event.addScore(team, 3,0);
event.addScore(team, 2,1);
event.addScore(team, 0,2);
assertEquals(5, event.getScore(team));
}
@Test
public void testInvalidScore() {
TeamEvent event = new TeamEvent("Volleyball");
List<Participant> team = new ArrayList<>();
team.add(new Participant("Tom"));
team.add(new Participant("Sarah"));
team.add(new Participant("Mike"));
event.addScore(team, 0,0);
event.addScore(team, -1,1);
event.addScore(team, 0,2);
assertEquals(-1, event.getScore(team));
}
}