Fixing merge and resulting failing tests
#fix #story[16]
This commit is contained in:
@@ -14,7 +14,6 @@ public class Boat {
|
|||||||
private StringProperty name;
|
private StringProperty name;
|
||||||
|
|
||||||
private double velocity;
|
private double velocity;
|
||||||
private double scaledVelocity;
|
|
||||||
private StringProperty velocityProp;
|
private StringProperty velocityProp;
|
||||||
private String abbrev;
|
private String abbrev;
|
||||||
|
|
||||||
@@ -51,14 +50,6 @@ public class Boat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double getScaledVelocity() {
|
|
||||||
return scaledVelocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScaledVelocity(double velocity) {
|
|
||||||
this.scaledVelocity = velocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return The Name of the boat.
|
* @return The Name of the boat.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import seng302.GPSCoordinate;
|
|||||||
public class BoatInRace extends Boat {
|
public class BoatInRace extends Boat {
|
||||||
|
|
||||||
private Leg currentLeg;
|
private Leg currentLeg;
|
||||||
|
private double scaledVelocity;
|
||||||
private double distanceTravelledInLeg;
|
private double distanceTravelledInLeg;
|
||||||
private GPSCoordinate currentPosition;
|
private GPSCoordinate currentPosition;
|
||||||
private long timeFinished;
|
private long timeFinished;
|
||||||
@@ -34,6 +35,14 @@ public class BoatInRace extends Boat {
|
|||||||
currentLegName = new SimpleStringProperty("");
|
currentLegName = new SimpleStringProperty("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getScaledVelocity() {
|
||||||
|
return scaledVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScaledVelocity(double velocity) {
|
||||||
|
this.scaledVelocity = velocity;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Returns the current position of the boat in a GPSCoordinate Class.
|
* @return Returns the current position of the boat in a GPSCoordinate Class.
|
||||||
|
|||||||
@@ -23,17 +23,9 @@ public class ConstantVelocityRace extends Race {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public ConstantVelocityRace(BoatInRace[] startingBoats, ArrayList<Leg> marks, RaceController controller, int scaleFactor) {
|
public ConstantVelocityRace(BoatInRace[] startingBoats, ArrayList<Leg> marks, RaceController controller, int scaleFactor) {
|
||||||
super(startingBoats, marks, controller);
|
super(startingBoats, marks, controller, scaleFactor);
|
||||||
setScaleFactor(scaleFactor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantVelocityRace(BoatInRace[] startingBoats, ArrayList<Leg> marks) {
|
|
||||||
super(startingBoats, marks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConstantVelocityRace(BoatInRace[] startingBoats, ArrayList<Leg> marks, int scaleFactor) {
|
|
||||||
super(startingBoats, marks, scaleFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updatePosition(BoatInRace boat, int millisecondsElapsed) {
|
protected void updatePosition(BoatInRace boat, int millisecondsElapsed) {
|
||||||
|
|
||||||
@@ -43,7 +35,6 @@ public class ConstantVelocityRace extends Race {
|
|||||||
|
|
||||||
boolean finish = boat.getCurrentLeg().getName().equals("Finish");
|
boolean finish = boat.getCurrentLeg().getName().equals("Finish");
|
||||||
if (!finish) {
|
if (!finish) {
|
||||||
|
|
||||||
boat.setDistanceTravelledInLeg(totalDistanceTravelled);
|
boat.setDistanceTravelledInLeg(totalDistanceTravelled);
|
||||||
boat.setCurrentPosition(calculatePosition(boat.getCurrentLeg().getStartGraphCoordinate(),
|
boat.setCurrentPosition(calculatePosition(boat.getCurrentLeg().getStartGraphCoordinate(),
|
||||||
totalDistanceTravelled, boat.calculateAzimuth()));
|
totalDistanceTravelled, boat.calculateAzimuth()));
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public class Leg {
|
|||||||
this.endGPSCoordinate = end;
|
this.endGPSCoordinate = end;
|
||||||
this.legNumber = number;
|
this.legNumber = number;
|
||||||
this.distance = calculateDistance();
|
this.distance = calculateDistance();
|
||||||
System.out.println("Distance of leg " + name + " is " + Double.toString(distance));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ public abstract class Race implements Runnable {
|
|||||||
protected int boatsFinished = 0;
|
protected int boatsFinished = 0;
|
||||||
protected long totalTimeElapsed;
|
protected long totalTimeElapsed;
|
||||||
|
|
||||||
protected int scaleFactor = 15;
|
protected int scaleFactor;
|
||||||
|
|
||||||
private int SLEEP_TIME = 100; //time in milliseconds to pause in a paced loop
|
private int SLEEP_TIME = 100; //time in milliseconds to pause in a paced loop
|
||||||
protected int PRERACE_TIME = 10000;//Integer.MAX_VALUE; //time in milliseconds to pause during pre-race
|
protected int PRERACE_TIME = 100;//Integer.MAX_VALUE; //time in milliseconds to pause during pre-race
|
||||||
private boolean timerEnabled = true;
|
private boolean timerEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,26 +31,27 @@ public abstract class Race implements Runnable {
|
|||||||
* @param boats Takes in an array of boats that are participating in the race.
|
* @param boats Takes in an array of boats that are participating in the race.
|
||||||
* @param legs Number of marks in order that the boats pass in order to complete the race.
|
* @param legs Number of marks in order that the boats pass in order to complete the race.
|
||||||
*/
|
*/
|
||||||
public Race(BoatInRace[] boats, ArrayList<Leg> legs, RaceController controller) {
|
public Race(BoatInRace[] boats, ArrayList<Leg> legs, RaceController controller, int scaleFactor) {
|
||||||
for (BoatInRace boat : boats) {
|
if (boats.length > 0) {
|
||||||
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
for (BoatInRace boat : boats) {
|
||||||
|
if (boat != null) {
|
||||||
|
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.startingBoats = FXCollections.observableArrayList(boats);
|
this.startingBoats = FXCollections.observableArrayList(boats);
|
||||||
this.legs = legs;
|
this.legs = legs;
|
||||||
this.legs.add(new Leg("Finish", this.legs.size()));
|
this.legs.add(new Leg("Finish", this.legs.size()));
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
this.scaleFactor = scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for Race class
|
* Constructor for Race class
|
||||||
* @param boats boats participating in the race.
|
* @param boats boats participating in the race.
|
||||||
* @param marks legs that there are in the race.
|
* @param legs legs that there are in the race.
|
||||||
*/
|
*/
|
||||||
public Race(BoatInRace[] boats, ArrayList<Leg> marks) {
|
|
||||||
this(boats, marks, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Race(BoatInRace[] boats, ArrayList<Leg> legs, int scaleFactor) {
|
public Race(BoatInRace[] boats, ArrayList<Leg> legs, int scaleFactor) {
|
||||||
if (boats.length > 0) {
|
if (boats.length > 0) {
|
||||||
for (BoatInRace boat : boats) {
|
for (BoatInRace boat : boats) {
|
||||||
@@ -66,11 +67,6 @@ public abstract class Race implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setScaleFactor(int scaleFactor) {
|
|
||||||
this.scaleFactor = scaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runnable for the thread.
|
* Runnable for the thread.
|
||||||
*/
|
*/
|
||||||
@@ -90,12 +86,8 @@ public abstract class Race implements Runnable {
|
|||||||
*/
|
*/
|
||||||
private void preRace() {
|
private void preRace() {
|
||||||
//show the boats participating.
|
//show the boats participating.
|
||||||
System.out.println("Boats Participating:");
|
|
||||||
System.out.println("====================");
|
|
||||||
for (int i = 0; i < startingBoats.size(); i++) {
|
for (int i = 0; i < startingBoats.size(); i++) {
|
||||||
if (startingBoats.get(i) != null) {
|
if (startingBoats.get(i) != null) {
|
||||||
System.out.println(i + 1 + ". " + startingBoats.get(i).getName() + ", Speed: "
|
|
||||||
+ Math.round(startingBoats.get(i).getVelocity() * 1.94384) + "kn");
|
|
||||||
startingBoats.get(i).setCurrentLeg(legs.get(0));
|
startingBoats.get(i).setCurrentLeg(legs.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +115,7 @@ public abstract class Race implements Runnable {
|
|||||||
hours = minutes / 60;
|
hours = minutes / 60;
|
||||||
minutes = minutes % 60;
|
minutes = minutes % 60;
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
updateTime(String.format("Time until race starts: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
|
updateTime(String.format("Race clock: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
</Label>
|
</Label>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<SplitPane fx:id="ongoingRacePane" dividerPositions="0.5" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<SplitPane fx:id="ongoingRacePane" dividerPositions="0.70" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<items>
|
<items>
|
||||||
<AnchorPane fx:id="canvasBase" prefHeight="581.0" prefWidth="537.0">
|
<AnchorPane fx:id="canvasBase" prefHeight="581.0" prefWidth="537.0">
|
||||||
<children>
|
<children>
|
||||||
|
|||||||
@@ -18,49 +18,50 @@ import static org.junit.Assert.assertEquals;
|
|||||||
*/
|
*/
|
||||||
public class ConstantVelocityRaceTest {
|
public class ConstantVelocityRaceTest {
|
||||||
|
|
||||||
|
Leg START_LEG = new Leg("Start", new GPSCoordinate(0, 0), new GPSCoordinate(50, 50), 0);
|
||||||
|
int ONE_HOUR = 3600000; //1 hour in milliseconds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updatePositionChangesDistanceTravelled() {
|
public void updatePositionChangesDistanceTravelled() {
|
||||||
|
|
||||||
BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
|
BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
|
||||||
Leg start = new Leg("Start", new GPSCoordinate(0, 0), new GPSCoordinate(50, 50), 0);
|
boat.setCurrentLeg(START_LEG);
|
||||||
boat.setCurrentLeg(start);
|
|
||||||
boat.setDistanceTravelledInLeg(0);
|
boat.setDistanceTravelledInLeg(0);
|
||||||
int timeElapsed = 3600000; //1 hr
|
BoatInRace[] boats = new BoatInRace[]{boat};
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>());
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, new ArrayList<Leg>(), null, 1);
|
||||||
|
|
||||||
race.updatePosition(boat, timeElapsed);
|
race.updatePosition(boat, ONE_HOUR);
|
||||||
assertEquals(boat.getDistanceTravelledInLeg(), boat.getVelocity() * timeElapsed / 3600000, 1e-8);
|
assertEquals(boat.getDistanceTravelledInLeg(), boat.getVelocity(), 1e-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updatePositionHandlesNoChangeToDistanceTravelled() {
|
public void updatePositionHandlesNoChangeToDistanceTravelled() {
|
||||||
|
|
||||||
BoatInRace boat = new BoatInRace("Test", 0, Color.ALICEBLUE, "tt");
|
BoatInRace boat = new BoatInRace("Test", 0, Color.ALICEBLUE, "tt");
|
||||||
Leg start = new Leg("Start", new GPSCoordinate(0, 0), new GPSCoordinate(50, 50), 0);
|
boat.setCurrentLeg(START_LEG);
|
||||||
boat.setCurrentLeg(start);
|
|
||||||
boat.setDistanceTravelledInLeg(0);
|
boat.setDistanceTravelledInLeg(0);
|
||||||
int timeElapsed = 3600000; //1 hr
|
BoatInRace[] boats = new BoatInRace[]{boat};
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>());
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, new ArrayList<Leg>(), null, 1);
|
||||||
|
|
||||||
race.updatePosition(boat, timeElapsed);
|
race.updatePosition(boat, ONE_HOUR);
|
||||||
assertEquals(boat.getDistanceTravelledInLeg(), 0, 1e-8);
|
assertEquals(boat.getDistanceTravelledInLeg(), 0, 1e-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void changesToDistanceTravelledAreAdditive() {
|
public void changesToDistanceTravelledAreAdditive() {
|
||||||
BoatInRace boat = new BoatInRace("Test", 5, Color.ALICEBLUE, "tt");
|
BoatInRace boat = new BoatInRace("Test", 5, Color.ALICEBLUE, "tt");
|
||||||
Leg start = new Leg("Start", new GPSCoordinate(0, 0), new GPSCoordinate(50, 50), 0);
|
boat.setCurrentLeg(START_LEG);
|
||||||
boat.setCurrentLeg(start);
|
|
||||||
boat.setDistanceTravelledInLeg(50);
|
boat.setDistanceTravelledInLeg(50);
|
||||||
int timeElapsed = 3600000; //1 hr
|
BoatInRace[] boats = new BoatInRace[]{boat};
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>());
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, new ArrayList<Leg>(), null, 1);
|
||||||
|
|
||||||
race.updatePosition(boat, timeElapsed);
|
race.updatePosition(boat, ONE_HOUR);
|
||||||
assertEquals(boat.getDistanceTravelledInLeg(), boat.getVelocity() * timeElapsed / 3600000 + 50, 1e-8);
|
assertEquals(boat.getDistanceTravelledInLeg(), boat.getVelocity() + 50, 1e-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -72,7 +73,6 @@ public class ConstantVelocityRaceTest {
|
|||||||
calc.setStartingGeographicPoint(0, 0);
|
calc.setStartingGeographicPoint(0, 0);
|
||||||
calc.setDirection(0, 10 * Constants.NMToMetersConversion);
|
calc.setDirection(0, 10 * Constants.NMToMetersConversion);
|
||||||
|
|
||||||
|
|
||||||
assertEquals(newPos.getLongitude(), 0, 1e-8);
|
assertEquals(newPos.getLongitude(), 0, 1e-8);
|
||||||
assertEquals(newPos.getLatitude(), calc.getDestinationGeographicPoint().getY(), 1e-8);
|
assertEquals(newPos.getLatitude(), calc.getDestinationGeographicPoint().getY(), 1e-8);
|
||||||
assertEquals(newPos.getLongitude(), calc.getDestinationGeographicPoint().getX(), 1e-8);
|
assertEquals(newPos.getLongitude(), calc.getDestinationGeographicPoint().getX(), 1e-8);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class RaceTest {
|
|||||||
ArrayList<Leg> legs = new ArrayList<>();
|
ArrayList<Leg> legs = new ArrayList<>();
|
||||||
legs.add(new Leg("Start", new GPSCoordinate(32.296577, -64.854304), new GPSCoordinate(32.293039, -64.843983), 0));
|
legs.add(new Leg("Start", new GPSCoordinate(32.296577, -64.854304), new GPSCoordinate(32.293039, -64.843983), 0));
|
||||||
legs.add(new Leg("Start", new GPSCoordinate(32.293039, -64.843983), new GPSCoordinate(32.284680, -64.850045), 1));
|
legs.add(new Leg("Start", new GPSCoordinate(32.293039, -64.843983), new GPSCoordinate(32.284680, -64.850045), 1));
|
||||||
Race race = new ConstantVelocityRace(boats, legs);
|
Race race = new ConstantVelocityRace(boats, legs, null, 1);
|
||||||
race.disableTimer();
|
race.disableTimer();
|
||||||
|
|
||||||
// Boats should finish in an order determined by their velocity
|
// Boats should finish in an order determined by their velocity
|
||||||
@@ -52,7 +52,7 @@ public class RaceTest {
|
|||||||
Leg leg = new Leg("Finish", new GPSCoordinate(0, 0), new GPSCoordinate(1, 1), 0);
|
Leg leg = new Leg("Finish", new GPSCoordinate(0, 0), new GPSCoordinate(1, 1), 0);
|
||||||
finishedBoat.setCurrentLeg(leg);
|
finishedBoat.setCurrentLeg(leg);
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>());
|
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>(), null, 1);
|
||||||
assertEquals(race.boatsFinished, 0);
|
assertEquals(race.boatsFinished, 0);
|
||||||
|
|
||||||
race.checkPosition(finishedBoat, 100);
|
race.checkPosition(finishedBoat, 100);
|
||||||
@@ -68,7 +68,7 @@ public class RaceTest {
|
|||||||
Leg leg = new Leg("Finish", new GPSCoordinate(0, 0), new GPSCoordinate(1, 1), 0);
|
Leg leg = new Leg("Finish", new GPSCoordinate(0, 0), new GPSCoordinate(1, 1), 0);
|
||||||
unFinishedBoat.setCurrentLeg(leg);
|
unFinishedBoat.setCurrentLeg(leg);
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>());
|
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<Leg>(), null, 1);
|
||||||
assertEquals(race.boatsFinished, 0);
|
assertEquals(race.boatsFinished, 0);
|
||||||
|
|
||||||
race.checkPosition(unFinishedBoat, 100);
|
race.checkPosition(unFinishedBoat, 100);
|
||||||
@@ -87,7 +87,7 @@ public class RaceTest {
|
|||||||
legs.add(leg2);
|
legs.add(leg2);
|
||||||
legs.add(leg2);
|
legs.add(leg2);
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], legs);
|
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], legs, null, 1);
|
||||||
|
|
||||||
BoatInRace unFinishedBoat = new BoatInRace("Test", 10, Color.ALICEBLUE, "tt");
|
BoatInRace unFinishedBoat = new BoatInRace("Test", 10, Color.ALICEBLUE, "tt");
|
||||||
unFinishedBoat.setDistanceTravelledInLeg(100);
|
unFinishedBoat.setDistanceTravelledInLeg(100);
|
||||||
@@ -102,7 +102,7 @@ public class RaceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void timerDelaysByHalfSecond() {
|
public void timerDelaysByHalfSecond() {
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<>());
|
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[1], new ArrayList<>(), null, 1);
|
||||||
race.PRERACE_TIME = 500;
|
race.PRERACE_TIME = 500;
|
||||||
|
|
||||||
long timeStarted = System.currentTimeMillis();
|
long timeStarted = System.currentTimeMillis();
|
||||||
@@ -126,7 +126,7 @@ public class RaceTest {
|
|||||||
BoatInRace boat4 = new BoatInRace("test", vel4, Color.ALICEBLUE, "tt");
|
BoatInRace boat4 = new BoatInRace("test", vel4, Color.ALICEBLUE, "tt");
|
||||||
BoatInRace[] boats = new BoatInRace[]{boat1, boat2, boat3, boat4};
|
BoatInRace[] boats = new BoatInRace[]{boat1, boat2, boat3, boat4};
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(boats, new ArrayList<Leg>(), scaleFactor);
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, new ArrayList<Leg>(), null, scaleFactor);
|
||||||
assertEquals(race.getStartingBoats().get(0).getScaledVelocity(), vel1 * scaleFactor, 1e-6);
|
assertEquals(race.getStartingBoats().get(0).getScaledVelocity(), vel1 * scaleFactor, 1e-6);
|
||||||
assertEquals(race.getStartingBoats().get(1).getScaledVelocity(), vel2 * scaleFactor, 1e-6);
|
assertEquals(race.getStartingBoats().get(1).getScaledVelocity(), vel2 * scaleFactor, 1e-6);
|
||||||
assertEquals(race.getStartingBoats().get(2).getScaledVelocity(), vel3 * scaleFactor, 1e-6);
|
assertEquals(race.getStartingBoats().get(2).getScaledVelocity(), vel3 * scaleFactor, 1e-6);
|
||||||
@@ -136,7 +136,7 @@ public class RaceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void scalerScalesRaceClockTo1MinCorrectly() {
|
public void scalerScalesRaceClockTo1MinCorrectly() {
|
||||||
int scaleFactor = 10;
|
int scaleFactor = 10;
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[5], new ArrayList<Leg>(), scaleFactor);
|
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[5], new ArrayList<Leg>(), null, scaleFactor);
|
||||||
race.totalTimeElapsed = 6000; //6 seconds
|
race.totalTimeElapsed = 6000; //6 seconds
|
||||||
assertTrue(race.calcTimer().equals("Race clock: 00:01:00"));
|
assertTrue(race.calcTimer().equals("Race clock: 00:01:00"));
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ public class RaceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void scalerScalesRaceClockHoursMinutesAndSecondsCorrectly() {
|
public void scalerScalesRaceClockHoursMinutesAndSecondsCorrectly() {
|
||||||
int scaleFactor = 3;
|
int scaleFactor = 3;
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[5], new ArrayList<Leg>(), scaleFactor);
|
ConstantVelocityRace race = new ConstantVelocityRace(new BoatInRace[5], new ArrayList<Leg>(), null, scaleFactor);
|
||||||
race.totalTimeElapsed = 3213000;
|
race.totalTimeElapsed = 3213000;
|
||||||
assertTrue(race.calcTimer().equals("Race clock: 02:40:39"));
|
assertTrue(race.calcTimer().equals("Race clock: 02:40:39"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user