Skip to content

Commit

Permalink
Merge pull request eclipse-ee4j#288 from ibrahimdoss/isExpectedTest
Browse files Browse the repository at this point in the history
TestNextExpectedEvent
  • Loading branch information
Reza Rahman authored Jan 6, 2024
2 parents dadd144 + ffc60b4 commit 50814d1
Showing 1 changed file with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,52 @@ public void testCargoOnTrack() {

@Test
public void testNextExpectedEvent() {
// TODO [TDD] Complete this test.
TrackingId trackingId = new TrackingId("CARGO1");
RouteSpecification routeSpecification =
new RouteSpecification(
SampleLocations.SHANGHAI, SampleLocations.GOTHENBURG, LocalDate.now());
Cargo cargo = new Cargo(trackingId, routeSpecification);

Itinerary itinerary = new Itinerary(Arrays.asList(
new Leg(
voyage,
SampleLocations.SHANGHAI,
SampleLocations.ROTTERDAM,
LocalDateTime.now(),
LocalDateTime.now()),
new Leg(
voyage,
SampleLocations.ROTTERDAM,
SampleLocations.GOTHENBURG,
LocalDateTime.now(),
LocalDateTime.now())));

HandlingEvent receiveEvent = new HandlingEvent(
cargo,
LocalDateTime.now(),
LocalDateTime.now(),
HandlingEvent.Type.RECEIVE,
SampleLocations.SHANGHAI);
assertTrue(itinerary.isExpected(receiveEvent));


HandlingEvent unexpectedEvent = new HandlingEvent(
cargo,
LocalDateTime.now(),
LocalDateTime.now(),
HandlingEvent.Type.UNLOAD,
SampleLocations.ROTTERDAM,
wrongVoyage);
assertFalse(itinerary.isExpected(unexpectedEvent));

HandlingEvent claimEvent = new HandlingEvent(
cargo,
LocalDateTime.now(),
LocalDateTime.now(),
HandlingEvent.Type.CLAIM,
SampleLocations.GOTHENBURG);
assertTrue(itinerary.isExpected(claimEvent));

}

@Test
Expand Down

0 comments on commit 50814d1

Please sign in to comment.