Added tests for BoatXMLReader

- Verifies correct operation on boat and mark reading from boatTest.xml

#story[782]
This commit is contained in:
cbt24
2017-05-10 14:23:33 +12:00
parent 9aa4183a7c
commit 9902cec688
3 changed files with 65 additions and 4 deletions
@@ -80,14 +80,14 @@ public class BoatXMLReader extends XMLReader implements BoatDataSource {
*/
private void readSingleBoat(Node boatNode) {
Boat boat;
String country = null;
int sourceID = Integer.parseInt(boatNode.getAttributes().getNamedItem("SourceID").getTextContent());
String name = boatNode.getAttributes().getNamedItem("BoatName").getTextContent();
String shortName = boatNode.getAttributes().getNamedItem("ShortName").getTextContent();
if (exists(boatNode, "Country")) country = boatNode.getAttributes().getNamedItem("Country").getTextContent();
if (isYachtNode(boatNode)) {
if (country != null) {
String shortName = boatNode.getAttributes().getNamedItem("ShortName").getTextContent();
if (exists(boatNode, "Country")) {
String country = boatNode.getAttributes().getNamedItem("Country").getTextContent();
boat = new Boat(sourceID, name, country);
} else {
boat = new Boat(sourceID, name, shortName);
@@ -9,4 +9,8 @@ public class Mark {
public Mark(String name) {
this.name = name;
}
public String getName() {
return name;
}
}