Added tests for BoatXMLReader
- Verifies correct operation on boat and mark reading from boatTest.xml #story[782]
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user