-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndividualEventTest.java
More file actions
48 lines (39 loc) · 1.36 KB
/
IndividualEventTest.java
File metadata and controls
48 lines (39 loc) · 1.36 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 WID_Classes;
import static org.junit.Assert.*;
import java.util.List;
import org.junit.Test;
public class IndividualEventTest {
@Test
public void testAddScore() {
IndividualEvent event = new IndividualEvent("Running");
Participant p1 = new Participant("Alice");
Participant p2 = new Participant("Bob");
event.addScore(p1, 10);
event.addScore(p2, 20);
assertEquals(event.getScore(p1), 10);
assertEquals(event.getScore(p2), 20);
}
@Test
public void testGetScore() {
IndividualEvent event = new IndividualEvent("Running");
Participant p1 = new Participant("Alice");
Participant p2 = new Participant("Bob");
event.addScore(p1, 10);
event.addScore(p2, 20);
assertEquals(event.getScore(p1), 10);
assertEquals(event.getScore(p2), 20);
}
@Test
public void testGetWinners() {
IndividualEvent event = new IndividualEvent("Running");
Participant p1 = new Participant("Alice");
Participant p2 = new Participant("Bob");
Participant p3 = new Participant("Charlie");
event.addScore(p1, 10);
event.addScore(p2, 20);
event.addScore(p3, 15);
List<Participant> winners = event.getWinners();
assertEquals(winners.size(), 1);
assertEquals(winners.get(0), p2);
}
}