blob: c3282bf579c0c8a8c6b31a491f898039fa025704 (
plain) (
blame)
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
|
package design.model;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import design.model.Club.ClubType;
import java.util.ArrayList;
/** Unit Tests for the Play class.
* @author Willem Dalton
**/
@Tag("Model-tier")
public class TestPlay {
@Test
void testConstructor()
{
Play testPlay = new Play(0);
assertEquals(0, testPlay.getHoleNumber());
}
@Test
void testConstructorNull()
{
Play testPlay2 = new Play(0, null);
assertEquals(0, testPlay2.getHoleNumber());
assertEquals(0, testPlay2.getSwings().length);
}
@Test
void testConstructorNotNull()
{
Club newClub = new Club("John Doe Inc", "The Slammer", ClubType.DRIVER);
Swing newSwing = new Swing(100, newClub);
ArrayList<Swing> swings = new ArrayList<Swing>();
swings.add(newSwing);
Play testPlay3 = new Play(0, swings);
assertEquals(0, testPlay3.getHoleNumber());
assertEquals(swings.get(0), testPlay3.getSwings()[0]);
}
}
|