55565758596061
public void ship() { if (status != ShippingStatus.WAITING) { throw new IllegalStateException("cannot ship in status " + status); } status = ShippingStatus.SENT; eventPublisher.publish(new OrderShippedEvent(orderId, getAggregateId())); }