Merge remote-tracking branch 'origin/story_30' into story_30
This commit is contained in:
@@ -2,8 +2,9 @@ package seng302.Mock;
|
|||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import seng302.RaceXMLReader;
|
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,7 +14,7 @@ public class RegattaXMLTest {
|
|||||||
RegattaXMLReader regattaXMLReader;
|
RegattaXMLReader regattaXMLReader;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void canFindFile(){
|
public void findFile(){
|
||||||
try {
|
try {
|
||||||
regattaXMLReader = new RegattaXMLReader("mockXML/regattaXML/regattaTest.xml", false);
|
regattaXMLReader = new RegattaXMLReader("mockXML/regattaXML/regattaTest.xml", false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -21,4 +22,31 @@ public class RegattaXMLTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void makeRegattaTest() {
|
||||||
|
try {
|
||||||
|
regattaXMLReader = new RegattaXMLReader("mockXML/regattaXML/regattaTest.xml");
|
||||||
|
assertNotEquals(regattaXMLReader.getRegatta(), null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail("Did not make a Regatta object");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void correctValuesTest() {
|
||||||
|
try {
|
||||||
|
regattaXMLReader = new RegattaXMLReader("mockXML/regattaXML/regattaTest.xml");
|
||||||
|
Regatta regatta = regattaXMLReader.getRegatta();
|
||||||
|
assertEquals(regatta.getRegattaID(), 3);
|
||||||
|
assertEquals(regatta.getRegattaName(), "New Zealand Test");
|
||||||
|
assertEquals(regatta.getCourseName(), "North Head");
|
||||||
|
assertEquals(regatta.getCentralLatitude(), -36.82791529, 0.00000001);
|
||||||
|
assertEquals(regatta.getCentralLongitude(), 174.81218919, 0.00000001);
|
||||||
|
assertEquals(regatta.getCentralAltitude(), 0.00, 0.00000001);
|
||||||
|
assertEquals(regatta.getUtcOffset(), 12.0, 0.001);
|
||||||
|
assertEquals(regatta.getMagneticVariation(), 14.1, 0.001);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail("Did not have the correct values");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user