private void manifestTest(TestResult result) { Fleet fleet = new Fleet(); try { fleet.add("Fast"); fleet.add("Medium"); fleet.add("Slow"); if (!Arrays.toString(fleet.manifest).equals("[Fast, Medium, Slow]")) { result.addComment("Invalid Manifest: " + Arrays.toString(fleet.manifest)); result.setResult(false); } else result.addComment("Manifest add: Passed"); } catch (Exception e) { result.setException(e); } }
private void fleetTest(TestResult result) { Fleet fleet = new Fleet(); fleet.add("Fast", 2); fleet.add("Medium", 3); fleet.add("Slow", 4); try { IShip[] fleets = fleet.generateFleet(); if (fleets.length != 9) if (result.getResult()) { result.addComment("Invalid length:" + fleets.length); result.setResult(false); } } catch (Exception e) { result.setException(e); } }