HandlingEvent implements Serializable { public Location getLocation() { return this.location; } HandlingEvent();  HandlingEvent(Cargo cargo, Date completionTime,
            Date registrationTime, Type type, Location location, Voyage voyage);  HandlingEvent(Cargo cargo, Date completionTime,
            Date registrationTime, Type type, Location location); Type getType(); Voyage getVoyage(); Date getCompletionTime(); Date getRegistrationTime(); Location getLocation(); Cargo getCargo(); String getSummary(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testNewWithCarrierMovement() { HandlingEvent event1 = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.LOAD, SampleLocations.HONGKONG, SampleVoyages.CM003); assertEquals(SampleLocations.HONGKONG, event1.getLocation()); HandlingEvent event2 = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.UNLOAD, SampleLocations.NEWYORK, SampleVoyages.CM003); assertEquals(SampleLocations.NEWYORK, event2.getLocation()); for (HandlingEvent.Type type : Arrays.asList(HandlingEvent.Type.CLAIM, HandlingEvent.Type.RECEIVE, HandlingEvent.Type.CUSTOMS)) { try { new HandlingEvent(cargo, new Date(), new Date(), type, SampleLocations.HONGKONG, SampleVoyages.CM003); fail("Handling event type " + type + " prohibits carrier movement"); } catch (IllegalArgumentException expected) { } } for (HandlingEvent.Type type : Arrays.asList(HandlingEvent.Type.LOAD, HandlingEvent.Type.UNLOAD)) { try { new HandlingEvent(cargo, new Date(), new Date(), type, SampleLocations.HONGKONG, null); fail("Handling event type " + type + " requires carrier movement"); } catch (NullPointerException expected) { } } }
@Test public void testNewWithLocation() { HandlingEvent event1 = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.CLAIM, SampleLocations.HELSINKI); assertEquals(SampleLocations.HELSINKI, event1.getLocation()); }
@Test public void testCurrentLocationLoadEvent() throws Exception { HandlingEvent event = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.LOAD, SampleLocations.CHICAGO, SampleVoyages.CM004); assertEquals(SampleLocations.CHICAGO, event.getLocation()); }
@Test public void testCurrentLocationUnloadEvent() throws Exception { HandlingEvent ev = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.UNLOAD, SampleLocations.HAMBURG, SampleVoyages.CM004); org.junit.Assert .assertEquals(SampleLocations.HAMBURG, ev.getLocation()); }
@Test public void testCurrentLocationReceivedEvent() throws Exception { HandlingEvent event = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.RECEIVE, SampleLocations.CHICAGO); assertEquals(SampleLocations.CHICAGO, event.getLocation()); }
@Test public void testCurrentLocationClaimedEvent() throws Exception { HandlingEvent event = new HandlingEvent(cargo, new Date(), new Date(), HandlingEvent.Type.CLAIM, SampleLocations.CHICAGO); assertEquals(SampleLocations.CHICAGO, event.getLocation()); }