diff options
| author | WillemDalton <willemhdalton@gmail.com> | 2025-11-14 12:27:53 -0500 |
|---|---|---|
| committer | WillemDalton <willemhdalton@gmail.com> | 2025-11-14 12:27:53 -0500 |
| commit | dd60732c456a6e0851f8b2f8e24600cc9eed77d0 (patch) | |
| tree | 91336d48722397fc895128a079fb0c910a9f21cc /src/test/java/design/model/PlayTest.java | |
| parent | cf3db9a7e13f7e919381cd2c8555ee31e3d50cf0 (diff) | |
| download | designproject-design-6-dd60732c456a6e0851f8b2f8e24600cc9eed77d0.tar.gz designproject-design-6-dd60732c456a6e0851f8b2f8e24600cc9eed77d0.tar.bz2 designproject-design-6-dd60732c456a6e0851f8b2f8e24600cc9eed77d0.zip | |
finished unit testing for teams and matches
Diffstat (limited to 'src/test/java/design/model/PlayTest.java')
| -rw-r--r-- | src/test/java/design/model/PlayTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/java/design/model/PlayTest.java b/src/test/java/design/model/PlayTest.java new file mode 100644 index 0000000..0a27076 --- /dev/null +++ b/src/test/java/design/model/PlayTest.java @@ -0,0 +1,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 PlayTest { + @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]); + } +} |
