Preparing your design workspace

Loading the problem and your saved attempt…

Warehouse Order Transit Tracking

Design and implement an in-memory Java model that tracks an order as it departs from and arrives at warehouses and reports overdue transit.

Design an object-oriented Java model for tracking an order as it moves between warehouses. The order must record when it leaves one warehouse, when it arrives at another, and whether its current trip has exceeded the maximum time allowed outside a warehouse.

For this exercise, assume each order begins at exactly one warehouse at a caller-supplied initial timestamp and is either at one warehouse or in transit to one recorded destination; split shipments and rerouting are out of scope. A positive maximum transit Duration is supplied when the order is created.

An in-transit order is expired only when now is strictly later than departedAt plus that Duration; an order at a warehouse is never expired.

Callers supply timestamps, accepted timestamps never move backward, an arrival must match the recorded destination, and duplicate or state-incompatible events are rejected without changing order state.

The foundation is an in-memory, single-process design. Persistence, route selection, inventory, and network transport are out of scope. A follow-up will ask how to preserve the same rules when concurrent workers and retried commands update one order.

Clarify the behavioral contract, model responsibilities, define public interfaces, walk through successful and rejected movements, and implement the central transition and expiry behavior of the Order object in Java.