diff --git a/pom.xml b/pom.xml
index 0cac5cc7..a3e030d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,8 +21,17 @@
gt-referencing
9.0
+
+
+
+ org.mockito
+ mockito-all
+ 1.9.5
+
+
+
maven2-repository.dev.java.net
diff --git a/src/main/java/seng302/Model/Boat.java b/src/main/java/seng302/Model/Boat.java
index 4cd2503b..e2169e56 100644
--- a/src/main/java/seng302/Model/Boat.java
+++ b/src/main/java/seng302/Model/Boat.java
@@ -53,7 +53,7 @@ public class Boat {
* @return The Name of the boat.
*/
public String toString(){
- return getName().getValue();
+ return getName().toString();
}
public StringProperty getVelocityProp() {
diff --git a/src/test/java/seng302/Model/BoatInRaceTest.java b/src/test/java/seng302/Model/BoatInRaceTest.java
new file mode 100644
index 00000000..74a01e52
--- /dev/null
+++ b/src/test/java/seng302/Model/BoatInRaceTest.java
@@ -0,0 +1,116 @@
+package seng302.Model;
+
+import javafx.scene.paint.Color;
+import org.junit.Ignore;
+import org.junit.Test;
+import seng302.GPSCoordinate;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
+
+/**
+ * Created by esa46 on 22/03/17.
+ */
+public class BoatInRaceTest {
+
+
+
+ @Test
+ public void calculateDueNorthAzimuthReturns0() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(0, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(50, 0);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateAzimuth(), 0, 1e-8);
+ }
+
+ @Test
+ public void calculateDueSouthAzimuthReturns180() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(0, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(-50, 0);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateAzimuth(), 180, 1e-8);
+ }
+
+
+ @Test
+ public void calculateDueEastAzimuthReturns90() {
+
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(0, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(0, 50);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateAzimuth(), 90, 1e-8);
+ }
+
+
+ @Test
+ public void calculateDueWestAzimuthReturnsNegative90() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(0, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(0, -50);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateAzimuth(), -90, 1e-8);
+
+ }
+
+ @Test
+ public void calculateDueNorthHeadingReturns0() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(10, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(50, 0);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateHeading(), 0, 1e-8);
+ }
+
+ @Test
+ public void calculateDueEastHeadingReturns90() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(0, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(0, 50);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateHeading(), 90, 1e-8);
+ }
+
+ @Test
+ public void calculateDueSouthHeadingReturns180() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(10, 0);
+ GPSCoordinate endPoint = new GPSCoordinate(-50, 0);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateHeading(), 180, 1e-8);
+ }
+
+ @Test
+ public void calculateDueWestHeadingReturns270() {
+ BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
+ GPSCoordinate startPoint = new GPSCoordinate(0, 10);
+ GPSCoordinate endPoint = new GPSCoordinate(0, -50);
+ Leg start = new Leg("Start", startPoint, endPoint, 0);
+ boat.setCurrentLeg(start);
+ assertEquals(boat.calculateHeading(), 270, 1e-8);
+ }
+
+ @Test
+ public void createNewBoatCratesInstanceOfSuperClass() {
+
+ BoatInRace testBoat = new BoatInRace("Boat", 20, Color.ALICEBLUE, "tt");
+ testBoat.setName("Name can change");
+ assertTrue(testBoat instanceof Boat);
+ assertTrue(testBoat.getCurrentLeg() == null);
+ assertTrue(testBoat.getCurrentPosition() == null);
+ assertTrue(testBoat.toString().contains("Name can change"));
+ assertEquals(testBoat.getVelocity(), 20.0);
+ //assertTrue(testBoat.getName().equals("Name can change"));
+
+ }
+
+}
\ No newline at end of file