mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Reimplemented race position in the race view. Removed Boat class and Yacht class is replaced completely. Race position "-" shows properly on start screen. Removed BoatTest and TeamsParserTest. Fixed estimated time till finish on server.
#story[818]
This commit is contained in:
@@ -1,35 +1,35 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import seng302.models.Boat;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for the Team class.
|
||||
*/
|
||||
public class BoatTest {
|
||||
|
||||
@Test
|
||||
public void testBoatCreation() {
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
assertEquals(boat1.getTeamName(), "Team 1");
|
||||
assertEquals(boat1.getVelocity(), (double) 10.0, 1e-15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangeTeamName() {
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
boat1.setTeamName("Team 2");
|
||||
assertEquals(boat1.getTeamName(), "Team 2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetVelocity() {
|
||||
Boat boat1 = new Boat("Team 1", 29.0, "", 100);
|
||||
assertEquals(boat1.getVelocity(), (double) 29.0, 1e-15);
|
||||
|
||||
boat1.setVelocity(12.0);
|
||||
assertEquals(boat1.getVelocity(), (double)12.0, 1e-15);
|
||||
}
|
||||
}
|
||||
//package seng302;
|
||||
//
|
||||
//import org.junit.Test;
|
||||
//import seng302.models.Boat;
|
||||
//
|
||||
//import static org.junit.Assert.assertEquals;
|
||||
//
|
||||
///**
|
||||
// * Unit test for the Team class.
|
||||
// */
|
||||
//public class BoatTest {
|
||||
//
|
||||
// @Test
|
||||
// public void testBoatCreation() {
|
||||
// Boat boat1 = new Boat("Team 1");
|
||||
// assertEquals(boat1.getTeamName(), "Team 1");
|
||||
// assertEquals(boat1.getVelocity(), (double) 10.0, 1e-15);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testChangeTeamName() {
|
||||
// Boat boat1 = new Boat("Team 1");
|
||||
// boat1.setTeamName("Team 2");
|
||||
// assertEquals(boat1.getTeamName(), "Team 2");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testSetVelocity() {
|
||||
// Boat boat1 = new Boat("Team 1", 29.0, "", 100);
|
||||
// assertEquals(boat1.getVelocity(), (double) 29.0, 1e-15);
|
||||
//
|
||||
// boat1.setVelocity(12.0);
|
||||
// assertEquals(boat1.getVelocity(), (double)12.0, 1e-15);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import seng302.models.Boat;
|
||||
import seng302.models.Event;
|
||||
import seng302.models.Yacht;
|
||||
import seng302.models.mark.SingleMark;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -15,14 +15,14 @@ public class EventTest {
|
||||
|
||||
@Test
|
||||
public void getTimeString() throws Exception {
|
||||
Boat boat = new Boat("testBoat");
|
||||
Yacht boat = new Yacht("testBoat");
|
||||
Event event = new Event(1231242.2, boat, new SingleMark("mark1"), new SingleMark("mark2"), 0);
|
||||
assertEquals("20:31:242", event.getTimeString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBoatHeading() throws Exception {
|
||||
Boat boat = new Boat("testBoat");
|
||||
Yacht boat = new Yacht("testBoat");
|
||||
Event event = new Event(1231242.2, boat, new SingleMark("mark1", 142.5, 122.1, 1), new SingleMark("mark2", 121.9,99.2, 2), 0);
|
||||
|
||||
assertEquals(event.getBoatHeading(), 228.0266137055349, 1e-15);
|
||||
@@ -30,7 +30,7 @@ public class EventTest {
|
||||
|
||||
@Test
|
||||
public void testDistanceBetweenMarks() throws Exception {
|
||||
Boat boat = new Boat("testBoat");
|
||||
Yacht boat = new Yacht("testBoat");
|
||||
Event event = new Event(1231242.2, boat, new SingleMark("mark1", 142.5, 122.1, 1), new SingleMark("mark2", 121.9,99.2, 2), 0);
|
||||
|
||||
assertEquals(event.getDistanceBetweenMarks(), 339059.653830461, 1e-15);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import seng302.models.Boat;
|
||||
import seng302.models.Race;
|
||||
import seng302.models.Yacht;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
@@ -17,8 +17,8 @@ public class RaceTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAddingBoatsToRace() {
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
Boat boat2 = new Boat("Team 2");
|
||||
Yacht boat1 = new Yacht("Team 1");
|
||||
Yacht boat2 = new Yacht("Team 2");
|
||||
|
||||
Race race = new Race();
|
||||
race.addBoat(boat1);
|
||||
@@ -29,8 +29,8 @@ public class RaceTest {
|
||||
|
||||
@Test
|
||||
public void testGetShuffledBoats(){
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
Boat boat2 = new Boat("Team 2");
|
||||
Yacht boat1 = new Yacht("Team 1");
|
||||
Yacht boat2 = new Yacht("Team 2");
|
||||
|
||||
Race race = new Race();
|
||||
race.addBoat(boat1);
|
||||
|
||||
@@ -16,7 +16,7 @@ public class BoatGroupTest {
|
||||
BoatGroup boatGroup;
|
||||
@Before
|
||||
public void setUp () {
|
||||
Boat b = new Boat("TEST", 0.0, "T" ,0);
|
||||
Yacht b = new Yacht("TEST", 0.0, "T" ,0);
|
||||
boatGroup = new BoatGroup(b, Color.BLACK);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
package seng302.models.parsers;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import seng302.models.Boat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by Haoming on 18/03/17.
|
||||
*/
|
||||
public class TeamsParserTest {
|
||||
|
||||
private TeamsParser tp;
|
||||
@Before
|
||||
public void readFile() {
|
||||
tp = new TeamsParser("/config/teams.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBoats() throws Exception {
|
||||
ArrayList<Boat> boats = tp.getBoats();
|
||||
|
||||
assertEquals(6, boats.size(), 1e-10);
|
||||
|
||||
assertEquals("Oracle Team USA", boats.get(0).getTeamName());
|
||||
//assertEquals(30.9, boats.get(0).getVelocity(), 1e-10);
|
||||
|
||||
assertEquals("Groupama Team France", boats.get(5).getTeamName());
|
||||
//assertEquals(45.6, boats.get(5).getVelocity(), 1e-10);
|
||||
}
|
||||
|
||||
}
|
||||
//package seng302.models.parsers;
|
||||
//
|
||||
//import org.junit.Before;
|
||||
//import org.junit.Test;
|
||||
//import seng302.models.Boat;
|
||||
//import seng302.models.Yacht;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//
|
||||
//import static org.junit.Assert.*;
|
||||
//
|
||||
///**
|
||||
// * Created by Haoming on 18/03/17.
|
||||
// */
|
||||
//public class TeamsParserTest {
|
||||
//
|
||||
// private TeamsParser tp;
|
||||
// @Before
|
||||
// public void readFile() {
|
||||
// tp = new TeamsParser("/config/teams.xml");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getBoats() throws Exception {
|
||||
// ArrayList<Yacht> boats = tp.getBoats();
|
||||
//
|
||||
// assertEquals(6, boats.size(), 1e-10);
|
||||
//
|
||||
// assertEquals("Oracle Team USA", boats.get(0).getBoatName());
|
||||
// //assertEquals(30.9, boats.get(0).getVelocity(), 1e-10);
|
||||
//
|
||||
// assertEquals("Groupama Team France", boats.get(5).getBoatName());
|
||||
// //assertEquals(45.6, boats.get(5).getVelocity(), 1e-10);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
Reference in New Issue
Block a user