Screenshoot of program results:
In terms of question 1, the functionalities have been tested are station construction, itinerary construction, station access, itinerary access, starting station visit, Simple Delivery at the first station; the functionalities haven¡¯t been tested are deliverable construction, cargo construction, go to next station, delivery at an arbitrary station.
For question 2, there are some code paths not been executed, when executing method ¡°deliver()¡± , ¡°deliverables.size() == 0¡± components have not been tested. There are some branched been executed, when function¡°deliver()¡±, ¡°deliverables.size() > 0¡± branches have been executed.
For question 3, there are lots of edge cases not been tested. For example, executing the getCurrentStation() method and the deliver() method, when the train arrives at the last station, it should return false when the train arrives at the last station. Secondly, execute the method deliver() when a station has no deliverables or multiple deliverables. Furthermore, another case is construct a station while no cargos, for example, ¡°new Station(¡°Murrundai¡±, new ArrayList
execute method ¡°deliver()¡± when the train arrives at this station. On the other hand, another case is executing ¡°deliver()¡± multiple times at a station. Finally, there is another edge case that there is only a station in the itinerary (the first station is the last station).
In terms of question 4 , I implement several tests: testDeliverableConstruction(), testCargoConstruction(),testGotoNextStation(),testOneStationTrain(), these tests are in the file¡±FreightServiceTest.java¡±