@Test(expected = IllegalArgumentException.class) public void requireOrderLinesWhenPlacingAnOrder() { Order order = new Order(); order.place(OrderId.<OrderId>randomId(), JOHN_DOE, Collections.<OrderLine>emptyList(), 2000L); }
public void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount) { assertHasNotBeenPlaced(); assertMoreThanZeroOrderLines(orderLines); applyChange(new OrderPlacedEvent(orderId, nextVersion(), now(), toCustomerInformation(customerInformation), toOrderLines(orderLines), totalAmount)); }
Order extends AggregateRoot<OrderId> { public void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount) { assertHasNotBeenPlaced(); assertMoreThanZeroOrderLines(orderLines); applyChange(new OrderPlacedEvent(orderId, nextVersion(), now(), toCustomerInformation(customerInformation), toOrderLines(orderLines), totalAmount)); } }
Order extends AggregateRoot<OrderId> { public void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount) { assertHasNotBeenPlaced(); assertMoreThanZeroOrderLines(orderLines); applyChange(new OrderPlacedEvent(orderId, nextVersion(), now(), toCustomerInformation(customerInformation), toOrderLines(orderLines), totalAmount)); }  }
Order extends AggregateRoot<OrderId> { public void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount) { assertHasNotBeenPlaced(); assertMoreThanZeroOrderLines(orderLines); applyChange(new OrderPlacedEvent(orderId, nextVersion(), now(), toCustomerInformation(customerInformation), toOrderLines(orderLines), totalAmount)); }  void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount); void activate(); }
Order extends AggregateRoot<OrderId> { public void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount) { assertHasNotBeenPlaced(); assertMoreThanZeroOrderLines(orderLines); applyChange(new OrderPlacedEvent(orderId, nextVersion(), now(), toCustomerInformation(customerInformation), toOrderLines(orderLines), totalAmount)); }  void place(OrderId orderId, CustomerInformation customerInformation, List<OrderLine> orderLines, long totalAmount); void activate();  }