summaryrefslogtreecommitdiff
path: root/src/test/java/design/model/RoundTest.java
blob: d472f5b5119c1d050495e7f68b3ca7b390022b62 (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
package design.model;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.time.LocalDateTime;
import java.util.ArrayList;

/** Unit Tests for the Round class.
 * @author Willem Dalton
 **/
@Tag("Model-tier")
public class RoundTest {
    
    @Test
    void testConstructor()
    {
        Course testCourse = new Course(0, "Rolling Waves", 62, "Rochester, NY", 9, 20, new ArrayList<Hole>());
        LocalDateTime testTime = LocalDateTime.now();
        Hole testHole = new Hole(0,3);
        Round testRound = new Round(testCourse, testTime, testHole);
        assertEquals(testCourse, testRound.getCourse());
        assertEquals(testTime, testRound.getDateTime());
        assertEquals(testHole, testRound.getStartingHole());
    }

    @Test
    void testHolePlay()
    {
        Course testCourse = new Course(0, "Rolling Waves", 62, "Rochester, NY", 9, 20, new ArrayList<Hole>());
        LocalDateTime testTime = LocalDateTime.now();
        Hole testHole = new Hole(0,3);
        Round testRound = new Round(testCourse, testTime, testHole);
        Play testPlay = new Play(0);

        testRound.addPlay(testPlay);
        assertEquals(1, testRound.getPlays().length);
        assertEquals(testPlay, testRound.getPlays()[0]);
    }
}