Cargo implements Serializable { public Delivery getDelivery() { return delivery; } Cargo();  Cargo(TrackingId trackingId, RouteSpecification routeSpecification); TrackingId getTrackingId(); void setOrigin(Location origin); Location getOrigin(); RouteSpecification getRouteSpecification(); Delivery getDelivery(); Itinerary getItinerary(); void specifyNewRoute(RouteSpecification routeSpecification); void assignToRoute(Itinerary itinerary); void deriveDeliveryProgress(HandlingHistory handlingHistory); @Override boolean equals(Object object); @Override int hashCode(); @Override String toString();  }
@Test public void testLastKnownLocationReceived() throws Exception { Cargo cargo = populateCargoReceivedStockholm(); assertEquals(SampleLocations.STOCKHOLM, cargo.getDelivery() .getLastKnownLocation()); }
@Test public void testLastKnownLocationClaimed() throws Exception { Cargo cargo = populateCargoClaimedMelbourne(); assertEquals(SampleLocations.MELBOURNE, cargo.getDelivery() .getLastKnownLocation()); }
@Test public void testLastKnownLocationUnloaded() throws Exception { Cargo cargo = populateCargoOffHongKong(); assertEquals(SampleLocations.HONGKONG, cargo.getDelivery() .getLastKnownLocation()); }
@Test public void testLastKnownLocationloaded() throws Exception { Cargo cargo = populateCargoOnHamburg(); assertEquals(SampleLocations.HAMBURG, cargo.getDelivery() .getLastKnownLocation()); }
@Test public void testConstruction() { TrackingId trackingId = new TrackingId("XYZ"); Date arrivalDeadline = DateUtil.toDate("2009-03-13"); RouteSpecification routeSpecification = new RouteSpecification( SampleLocations.STOCKHOLM, SampleLocations.MELBOURNE, arrivalDeadline); Cargo cargo = new Cargo(trackingId, routeSpecification); assertEquals(RoutingStatus.NOT_ROUTED, cargo.getDelivery() .getRoutingStatus()); assertEquals(TransportStatus.NOT_RECEIVED, cargo.getDelivery() .getTransportStatus()); assertEquals(Location.UNKNOWN, cargo.getDelivery() .getLastKnownLocation()); assertEquals(Voyage.NONE, cargo.getDelivery().getCurrentVoyage()); }
@Test public void testLastKnownLocationUnknownWhenNoEvents() { Cargo cargo = new Cargo(new TrackingId("XYZ"), new RouteSpecification( SampleLocations.STOCKHOLM, SampleLocations.MELBOURNE, new Date())); assertEquals(Location.UNKNOWN, cargo.getDelivery() .getLastKnownLocation()); }