parent
b976186c7d
commit
5e35cd4195
@ -1,47 +0,0 @@
|
|||||||
//package seng302.Mock;
|
|
||||||
//
|
|
||||||
//import org.junit.Before;
|
|
||||||
//import org.junit.Test;
|
|
||||||
//
|
|
||||||
//import java.util.HashMap;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
//import static org.junit.Assert.assertEquals;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by jjg64 on 21/04/17.
|
|
||||||
// */
|
|
||||||
//public class BoatsXMLTest {
|
|
||||||
// private BoatXMLReader boatXMLReader;
|
|
||||||
//
|
|
||||||
// @Before
|
|
||||||
// public void setup() {
|
|
||||||
// try {
|
|
||||||
// boatXMLReader = new BoatXMLReader("mockXML/boatXML/boatTest.xml", false);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// //fail("Cannot find mockXML/raceXML/raceTest.xml in the resources folder");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void testInvalidParticipant() {
|
|
||||||
// Map<Integer, StreamedBoat> inputParticipants = new HashMap<>();
|
|
||||||
// inputParticipants.put(420, new StreamedBoat(420));
|
|
||||||
// boatXMLReader.setParticipants(inputParticipants);
|
|
||||||
// boatXMLReader.read();
|
|
||||||
// assertEquals(boatXMLReader.getBoats().size(), 0);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void testValidParticipant() {
|
|
||||||
// Map<Integer, StreamedBoat> inputParticipants = new HashMap<>();
|
|
||||||
// inputParticipants.put(101, new StreamedBoat(101));
|
|
||||||
// boatXMLReader.setParticipants(inputParticipants);
|
|
||||||
// boatXMLReader.read();
|
|
||||||
// assertEquals(boatXMLReader.getBoats().size(), 1);
|
|
||||||
// StreamedBoat boat = (StreamedBoat) boatXMLReader.getBoats().get(0);
|
|
||||||
// assertEquals(boat.getSourceID(), 101);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
//package seng302.Mock;
|
|
||||||
//
|
|
||||||
//import org.junit.Test;
|
|
||||||
//import org.xml.sax.SAXException;
|
|
||||||
//
|
|
||||||
//import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
//import java.io.IOException;
|
|
||||||
//import java.text.ParseException;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by jjg64 on 1/05/17.
|
|
||||||
// */
|
|
||||||
//public class FailBoatXMLTest {
|
|
||||||
// private final String path = "mockXML/boatXML/";
|
|
||||||
//
|
|
||||||
// @Test(expected = NumberFormatException.class)
|
|
||||||
// public void invalidSourceID() throws SAXException, ParserConfigurationException, ParseException, IOException {
|
|
||||||
// new BoatXMLReader(path + "invalidSourceID.xml");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test(expected = NullPointerException.class)
|
|
||||||
// public void insufficientInformation() throws SAXException, ParserConfigurationException, ParseException, IOException {
|
|
||||||
// new BoatXMLReader(path + "insufficientInformation.xml");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@ -1,345 +0,0 @@
|
|||||||
//package shared.model;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//import mock.model.Polars;
|
|
||||||
//import org.junit.Before;
|
|
||||||
//import org.junit.Ignore;
|
|
||||||
//import org.junit.Test;
|
|
||||||
//import org.mockito.Mockito;
|
|
||||||
//import org.xml.sax.SAXException;
|
|
||||||
//
|
|
||||||
//import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
//import java.io.IOException;
|
|
||||||
//import java.text.ParseException;
|
|
||||||
//import java.util.ArrayList;
|
|
||||||
//
|
|
||||||
//import static org.junit.Assert.*;
|
|
||||||
//import static org.mockito.Mockito.*;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by esa46 on 15/03/17.
|
|
||||||
// */
|
|
||||||
//public class RaceTest{
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// private CompoundMark ORIGIN;
|
|
||||||
//
|
|
||||||
// private CompoundMark THREE_NM_FROM_ORIGIN;
|
|
||||||
//
|
|
||||||
// private CompoundMark FIFTEEN_NM_FROM_ORIGIN;
|
|
||||||
//
|
|
||||||
// private ArrayList<Leg> TEST_LEGS = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// private int START_LEG_DISTANCE = 3;
|
|
||||||
// private int MIDDLE_LEG_DISTANCE = 12;
|
|
||||||
//
|
|
||||||
// private Leg START_LEG;
|
|
||||||
//
|
|
||||||
// private Leg MIDDLE_LEG;
|
|
||||||
//
|
|
||||||
// private Leg FINISH_LEG;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Before
|
|
||||||
// public void setUp() {
|
|
||||||
//
|
|
||||||
// ORIGIN = new CompoundMark(
|
|
||||||
// 1,
|
|
||||||
// "origin compound",
|
|
||||||
// new Mark(1, "test origin 1", new GPSCoordinate(0, 0)) );
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// THREE_NM_FROM_ORIGIN = new CompoundMark(
|
|
||||||
// 2,
|
|
||||||
// "3 NM from origin compound",
|
|
||||||
// new Mark(2, "test mark 2", new GPSCoordinate(0.050246769, 0)) );
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// FIFTEEN_NM_FROM_ORIGIN = new CompoundMark(
|
|
||||||
// 3,
|
|
||||||
// "15 NM from origin compound",
|
|
||||||
// new Mark(3, "test mark 3", new GPSCoordinate(0.251233845, 0)) );
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// START_LEG = new Leg("Start", ORIGIN, THREE_NM_FROM_ORIGIN, 0);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// MIDDLE_LEG = new Leg("Middle", THREE_NM_FROM_ORIGIN, FIFTEEN_NM_FROM_ORIGIN, 1);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// FINISH_LEG = new Leg("Finish", FIFTEEN_NM_FROM_ORIGIN, FIFTEEN_NM_FROM_ORIGIN, 2);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// TEST_LEGS.add(START_LEG);
|
|
||||||
// TEST_LEGS.add(MIDDLE_LEG);
|
|
||||||
// TEST_LEGS.add(FINISH_LEG);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void countdownTimerSendsBoatLocations() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
|
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// testRace.countdownTimer.handle(1);
|
|
||||||
// verify(mockOutput, atLeast(boatDataSource.getBoats().size())).parseBoatLocation(anyInt(), anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyLong());
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void countdownTimerSendsRaceStatusMessages() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
|
|
||||||
// Race testRace = new Race(dataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// testRace.countdownTimer.handle(1);
|
|
||||||
// verify(mockOutput, atLeast(1)).parseRaceStatus(any());
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void checkPositionFinishedUpdatesNumberFinishedBoats() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
|
|
||||||
// Race testRace = new Race(dataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(FINISH_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(1);
|
|
||||||
// testRace.checkPosition(testBoat, 1);
|
|
||||||
//
|
|
||||||
// assertEquals(testRace.getNumberOfActiveBoats(), 0);
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void checkPositionSetFinishedBoatVelocityTo0() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
|
|
||||||
// Race testRace = new Race(dataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(FINISH_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(1);
|
|
||||||
// testRace.checkPosition(testBoat, 1);
|
|
||||||
//
|
|
||||||
// assertEquals(testBoat.getCurrentSpeed(), 0, 1e-8);
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void checkPositionSetsFinishTime() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
|
|
||||||
// Race testRace = new Race(dataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(FINISH_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(1);
|
|
||||||
// testRace.checkPosition(testBoat, 1);
|
|
||||||
//
|
|
||||||
// assertEquals(testBoat.getTimeFinished(), 1, 1e-8);
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void checkPositionUnfinishedDoesntUpdateNumberFinishedBoats() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
|
|
||||||
// Race testRace = new Race(dataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(START_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE);
|
|
||||||
// testRace.checkPosition(testBoat, 1);
|
|
||||||
//
|
|
||||||
// assertEquals(testRace.getNumberOfActiveBoats(), 1);
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void distanceTravelledBeforeUpdatingLegIsRetained() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
|
|
||||||
// Race testRace = new Race(dataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(START_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE + 1);
|
|
||||||
// testRace.checkPosition(testBoat, 0);
|
|
||||||
//
|
|
||||||
// assertEquals(testBoat.getDistanceTravelledInLeg(), 1, 1e-7);
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void doNotFinishAnswersYesIf100PercentChance() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
|
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
//
|
|
||||||
// testRace.setDnfChance(100);
|
|
||||||
// assertTrue(testRace.doNotFinish());
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void doNotFinishAnswersNoIf0PercentChance() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
|
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
// testRace.setDnfChance(0);
|
|
||||||
// assertFalse(testRace.doNotFinish());
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void boatsAreSetToDNF() {
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
|
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
// testRace.setDnfChance(100);
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(START_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE + 1);
|
|
||||||
// testRace.checkPosition(testBoat, 1);
|
|
||||||
// assertEquals(testBoat.getCurrentLeg().getName(), "DNF");
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void updatePositionIgnoresFinishedBoats() {
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
|
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(FINISH_LEG);
|
|
||||||
// testBoat.setCurrentPosition(ORIGIN.getAverageGPSCoordinate());
|
|
||||||
// testRace.updatePosition(testBoat, 1, 1);
|
|
||||||
// assertEquals(testBoat.getCurrentPosition(), ORIGIN.getAverageGPSCoordinate());
|
|
||||||
//
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void updatePositionChangesBoatPosition() {
|
|
||||||
// try {
|
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
|
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
// testRace.initialiseBoats();
|
|
||||||
// Boat testBoat = testRace.getBoats().get(0);
|
|
||||||
// testBoat.setCurrentLeg(START_LEG);
|
|
||||||
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE - 1);
|
|
||||||
// testBoat.setCurrentPosition(ORIGIN.getAverageGPSCoordinate());
|
|
||||||
// testRace.updatePosition(testBoat, 100, 100);
|
|
||||||
// assertFalse(testBoat.getCurrentPosition() == ORIGIN.getAverageGPSCoordinate());
|
|
||||||
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void windDirectionCorrectValues(){
|
|
||||||
//// try {
|
|
||||||
//// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
|
||||||
//// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml");
|
|
||||||
//// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
|
|
||||||
//// Race testRace = new Race(raceDataSource, mockOutput);
|
|
||||||
//// testRace.setChangeWind(1);
|
|
||||||
//// testRace.setWindDir(65535);
|
|
||||||
//// testRace.changeWindDir();
|
|
||||||
//// assertEquals(100, testRace.getWind());
|
|
||||||
//// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
|
|
||||||
//// e.printStackTrace();
|
|
||||||
//// fail();
|
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@ -1,100 +0,0 @@
|
|||||||
//package visualiser.model;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//import org.junit.Before;
|
|
||||||
//import org.junit.Test;
|
|
||||||
//import shared.dataInput.RaceXMLReader;
|
|
||||||
//import shared.dataInput.XMLReader;
|
|
||||||
//import shared.exceptions.InvalidRaceDataException;
|
|
||||||
//import shared.model.GPSCoordinate;
|
|
||||||
//
|
|
||||||
//import java.nio.charset.StandardCharsets;
|
|
||||||
//import java.util.List;
|
|
||||||
//
|
|
||||||
//import static org.junit.Assert.assertEquals;
|
|
||||||
//import static org.junit.Assert.fail;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Tests only work on the current version of mockXML/raceXML/raceTest.xml
|
|
||||||
// */
|
|
||||||
//public class VisualiserRaceTest {
|
|
||||||
// private RaceXMLReader streamedCourseXMLReader;
|
|
||||||
// private List<GPSCoordinate> boundary;
|
|
||||||
//
|
|
||||||
// @Before
|
|
||||||
// public void setup() {
|
|
||||||
// try {
|
|
||||||
// streamedCourseXMLReader = new RaceXMLReader(XMLReader.readXMLFileToString("mockXML/raceXML/raceTest.xml", StandardCharsets.UTF_8));
|
|
||||||
// boundary = streamedCourseXMLReader.getBoundary();
|
|
||||||
// } catch (InvalidRaceDataException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// fail("Cannot find mockXML/raceXML/raceTest.xml in the resources folder");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void testAllBoundaryPointsRead() {
|
|
||||||
// assertEquals(boundary.size(), 10);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void testBoundaryPointData() {
|
|
||||||
// // First point
|
|
||||||
// assertEquals(boundary.get(0).getLatitude(), -36.8325, 1e-6);
|
|
||||||
// assertEquals(boundary.get(0).getLongitude(), 174.8325, 1e-6);
|
|
||||||
//
|
|
||||||
// // Last point
|
|
||||||
// assertEquals(boundary.get(boundary.size() - 1).getLatitude(), -36.83417, 1e-6);
|
|
||||||
// assertEquals(boundary.get(boundary.size() - 1).getLongitude(), 174.84767, 1e-6);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void testMapEdges() {
|
|
||||||
// double maxLatitude = streamedCourseXMLReader.getMapBottomRight().getLatitude() - streamedCourseXMLReader.getPadding();
|
|
||||||
// double maxLongitude = streamedCourseXMLReader.getMapBottomRight().getLongitude() - streamedCourseXMLReader.getPadding();
|
|
||||||
// double minLatitude = streamedCourseXMLReader.getMapTopLeft().getLatitude() - streamedCourseXMLReader.getPadding();
|
|
||||||
// double minLongitude = streamedCourseXMLReader.getMapTopLeft().getLongitude() - streamedCourseXMLReader.getPadding();
|
|
||||||
//
|
|
||||||
// assertEquals(maxLatitude, -36.81033, 1e-6);
|
|
||||||
// assertEquals(maxLongitude, 174.88217, 1e-6);
|
|
||||||
// assertEquals(minLatitude, -36.83417, 1e-6);
|
|
||||||
// assertEquals(minLongitude, 174.81983, 1e-6);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void testRaceSettings() {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void correctLegSequence() {
|
|
||||||
// List<Leg> legs = streamedCourseXMLReader.getLegs();
|
|
||||||
// String[] expectedNames = {
|
|
||||||
// "StartLine",
|
|
||||||
// "M1",
|
|
||||||
// "M2",
|
|
||||||
// "Gate"
|
|
||||||
// };
|
|
||||||
// for(int i = 0; i < legs.size(); i++) {
|
|
||||||
// assertEquals(expectedNames[i], legs.get(i).getName());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * raceTest.xml is not compliant with this test. Markers are positioned far out of bounds.
|
|
||||||
// */
|
|
||||||
// @Test
|
|
||||||
// @Ignore
|
|
||||||
// public void markersWithinRaceBoundaries() {
|
|
||||||
// GPSCoordinate topLeft = streamedCourseXMLReader.getMapTopLeft();
|
|
||||||
// GPSCoordinate bottomRight = streamedCourseXMLReader.getMapBottomRight();
|
|
||||||
//
|
|
||||||
// for(Marker compoundMark : streamedCourseXMLReader.getMarkers()) {
|
|
||||||
// GPSCoordinate centre = compoundMark.getAverageGPSCoordinate();
|
|
||||||
// assertTrue(centre.getLatitude() < bottomRight.getLatitude());
|
|
||||||
// assertTrue(centre.getLatitude() > topLeft.getLatitude());
|
|
||||||
// assertTrue(centre.getLongitude() > bottomRight.getLongitude());
|
|
||||||
// assertTrue(centre.getLongitude() < topLeft.getLongitude());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
Loading…
Reference in new issue