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
|
package design.model;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
/** Unit Tests for the Team Class.
* @author Willem Dalton
**/
@Tag("Model-tier")
public class TeamTest {
@Test
void testConstructor()
{
Golfer testGolfer = new Golfer("John Doe", "j_doe_golfs", "ilovegolf123");
Team testTeam = new Team("A Team", testGolfer);
assertEquals("A Team", testTeam.getName());
assertEquals(testGolfer, testTeam.getOwner());
}
@Test
void testSetName()
{
Golfer testGolfer = new Golfer("John Doe", "j_doe_golfs", "ilovegolf123");
Team testTeam = new Team("A Team", testGolfer);
testTeam.setName("B Team");
assertEquals("B Team", testTeam.getName());
}
@Test
void testRemoveMember()
{
Golfer testGolfer = new Golfer("John Doe", "j_doe_golfs", "ilovegolf123");
Golfer newGolfer = new Golfer("Jane Doe", "j_doe_golfs2", "ilovegolf321");
Team testTeam = new Team("A Team", testGolfer);
testTeam.addMember(newGolfer);
assertEquals(1, testTeam.getMembers().length);
testTeam.removeMember(newGolfer);
assertEquals(0, testTeam.getMembers().length);
}
}
|