- Verifies correct operation on boat and mark reading from boatTest.xml #story[782]main
parent
9aa4183a7c
commit
9902cec688
@ -0,0 +1,57 @@
|
|||||||
|
package seng302.DataInput;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
import seng302.Model.Boat;
|
||||||
|
import seng302.Model.Mark;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cbt24 on 10/05/17.
|
||||||
|
*/
|
||||||
|
public class BoatXMLReaderTest {
|
||||||
|
BoatDataSource boatData;
|
||||||
|
List<Boat> boats;
|
||||||
|
List<Mark> marks;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
try {
|
||||||
|
boatData = new BoatXMLReader("mockXML/boatTest.xml");
|
||||||
|
boats = boatData.getBoats();
|
||||||
|
marks = boatData.getMarkerBoats();
|
||||||
|
} catch (ParserConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SAXException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void boatsReadNameFromFile() {
|
||||||
|
String[] names = {
|
||||||
|
"Team ORACLE USA","Land Rover BAR","SoftBank Team Japan","Groupama Team France","Artemis Racing","Emirates Team New Zealand"
|
||||||
|
};
|
||||||
|
for(int i = 0; i < boats.size(); i++) {
|
||||||
|
assertEquals(names[i], boats.get(i).getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void marksReadNameFromFile() {
|
||||||
|
String[] names = {
|
||||||
|
"PRO","PIN","Marker1","WGL","WGR","LGL","LGR","FL","FR"
|
||||||
|
};
|
||||||
|
for(int i = 0; i < marks.size(); i++) {
|
||||||
|
assertEquals(names[i], marks.get(i).getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue