Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
// Create cargo with valid input from customer
TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).book();
// Retrieve created cargo from store
Cargo cargo = uow.get( Cargo.class, trackingId.id().get() );
// Test cargo data
assertThat( cargo.trackingId().get(), is( equalTo( trackingId ) ) );
assertThat( cargo.origin().get(), is( equalTo( HONGKONG ) ) );
// Test route specification
assertThat( cargo.routeSpecification().get().destination().get(), is( equalTo( STOCKHOLM ) ) );
// day(17) here is calculated a few milliseconds after initial day(17), so it will be later...
assertThat( cargo.routeSpecification().get().arrivalDeadline().get(), equalTo( day( 17 ) ));
// (Itinerary is not assigned yet)
// Test derived delivery snapshot
Delivery delivery = cargo.delivery().get();
assertThat( delivery.timestamp().get().after( TODAY ), is( equalTo( true ) ) ); // TODAY is set first
assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.NOT_ROUTED ) ) );
assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.NOT_RECEIVED ) ) );
assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( HandlingEventType.RECEIVE ) ) );
assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) );