} else if (f.getPath().endsWith(".ship")) {
ShipDescription sd = new ShipDescription(f.getName(), new BufferedReader(new InputStreamReader(new FileInputStream(f))));
String testsection = sd.getSection("test");
- if (testsection != null)
- runTest(fleet, new StringReader(testsection), sd.getName());
- else
+ if (testsection == null)
System.out.println("no test for " + sd.getName() + "!");
+ else if (fleet.getShip(sd.getName(),0)==null)
+ System.out.println("specified Fleet does not have any ships of type " + sd.getName());
+ else
+ runTest(fleet, new StringReader(testsection), sd.getName());
}
}
public Iterator<DockDescription> iterator() { return docks.values().iterator(); }
public ShipDescription(String name, BufferedReader r) throws IOException {
+ if (name.endsWith(".ship")) name = name.substring(0, name.length()-".ship".length());
this.name = name;
String sectionName = null;
StringBuffer sb = new StringBuffer();