// Path: order-context-parent/order-query/src/main/java/se/citerus/cqrs/bookstore/ordercontext/infrastructure/InMemOrderProjectionRepository.java
// public class InMemOrderProjectionRepository implements OrderProjectionRepository {
// 
//   private static final OrderTimestampComparator ORDER_TIMESTAMP_COMPARATOR = new OrderTimestampComparator();
//   private final Map<OrderId, OrderProjection> orders = new HashMap<>();
// 
//   private void saveOrder(OrderId orderId, OrderProjection orderProjection) {
//     orders.put(orderId, orderProjection);
//   }
// 
//   @Override
//   public void save(OrderProjection orderProjection) {
//     saveOrder(orderProjection.getOrderId(), orderProjection);
//   }
// 
//   @Override
//   public OrderProjection getById(OrderId orderId) {
//     return orders.get(orderId);
//   }
// 
//   @Override
//   public List<OrderProjection> listOrdersByTimestamp() {
//     List<OrderProjection> projections = new ArrayList<>(orders.values());
//     Collections.sort(projections, Collections.reverseOrder(ORDER_TIMESTAMP_COMPARATOR));
//     return projections;
//   }
// 
//   private static class OrderTimestampComparator implements Comparator<OrderProjection> {
//     @Override
//     public int compare(OrderProjection o1, OrderProjection o2) {
//       return Long.valueOf(o1.getOrderPlacedTimestamp()).compareTo(o2.getOrderPlacedTimestamp());
//     }
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/CustomerInformation.java
// public class CustomerInformation extends TransportObject {
// 
//   public final String customerName;
//   public final String email;
//   public final String address;
// 
//   public CustomerInformation(@JsonProperty("customerName") String customerName,
//                              @JsonProperty("email") String email,
//                              @JsonProperty("address") String address) {
//     this.customerName = customerName;
//     this.email = email;
//     this.address = address;
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderId.java
// public class OrderId extends GenericId {
// 
//   public OrderId(@JsonProperty("id") String id) {
//     super(id);
//   }
// 
//   public static OrderId randomId() {
//     return new OrderId(UUID.randomUUID().toString());
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderLine.java
// public class OrderLine extends TransportObject {
// 
//   public final ProductId productId;
//   public final String title;
//   public final int quantity;
//   public final long unitPrice;
// 
//   public OrderLine(@JsonProperty("productId") ProductId productId,
//                    @JsonProperty("title") String title,
//                    @JsonProperty("quantity") int quantity,
//                    @JsonProperty("unitPrice") long unitPrice) {
//     this.productId = productId;
//     this.title = title;
//     this.quantity = quantity;
//     this.unitPrice = unitPrice;
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderActivatedEvent.java
// public class OrderActivatedEvent extends DomainEvent<OrderId> {
// 
//   public OrderActivatedEvent(@JsonProperty("aggregateId") OrderId aggregateId,
//                              @JsonProperty("version") int version,
//                              @JsonProperty("timestamp") long timestamp) {
//     super(aggregateId, version, timestamp);
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderPlacedEvent.java
// public class OrderPlacedEvent extends DomainEvent<OrderId> {
// 
//   public final CustomerInformation customerInformation;
//   public final List<OrderLine> orderLines;
//   public final long orderAmount;
// 
//   public OrderPlacedEvent(@JsonProperty("aggregateId") OrderId id,
//                           @JsonProperty("version") int version,
//                           @JsonProperty("timestamp") long timestamp,
//                           @JsonProperty("customerInformation") CustomerInformation customerInformation,
//                           @JsonProperty("orderLines") List<OrderLine> orderLines,
//                           @JsonProperty("orderAmount") long orderAmount) {
//     super(id, version, timestamp);
//     this.customerInformation = customerInformation;
//     this.orderLines = Collections.unmodifiableList(orderLines);
//     this.orderAmount = orderAmount;
//   }
// 
// }


import org.junit.Before;
import org.junit.Test;
import se.citerus.cqrs.bookstore.ordercontext.infrastructure.InMemOrderProjectionRepository;
import se.citerus.cqrs.bookstore.ordercontext.order.CustomerInformation;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderId;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderLine;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderActivatedEvent;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderPlacedEvent;
import java.util.Collections;
import java.util.Iterator;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static se.citerus.cqrs.bookstore.ordercontext.order.OrderStatus.ACTIVATED;
package se.citerus.cqrs.bookstore.ordercontext.query.orderlist;




public class OrderListDenormalizerTest {

  private OrderListDenormalizer denormalizer;

  @Before
// Path: order-context-parent/order-query/src/main/java/se/citerus/cqrs/bookstore/ordercontext/infrastructure/InMemOrderProjectionRepository.java
// public class InMemOrderProjectionRepository implements OrderProjectionRepository {
// 
//   private static final OrderTimestampComparator ORDER_TIMESTAMP_COMPARATOR = new OrderTimestampComparator();
//   private final Map<OrderId, OrderProjection> orders = new HashMap<>();
// 
//   private void saveOrder(OrderId orderId, OrderProjection orderProjection) {
//     orders.put(orderId, orderProjection);
//   }
// 
//   @Override
//   public void save(OrderProjection orderProjection) {
//     saveOrder(orderProjection.getOrderId(), orderProjection);
//   }
// 
//   @Override
//   public OrderProjection getById(OrderId orderId) {
//     return orders.get(orderId);
//   }
// 
//   @Override
//   public List<OrderProjection> listOrdersByTimestamp() {
//     List<OrderProjection> projections = new ArrayList<>(orders.values());
//     Collections.sort(projections, Collections.reverseOrder(ORDER_TIMESTAMP_COMPARATOR));
//     return projections;
//   }
// 
//   private static class OrderTimestampComparator implements Comparator<OrderProjection> {
//     @Override
//     public int compare(OrderProjection o1, OrderProjection o2) {
//       return Long.valueOf(o1.getOrderPlacedTimestamp()).compareTo(o2.getOrderPlacedTimestamp());
//     }
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/CustomerInformation.java
// public class CustomerInformation extends TransportObject {
// 
//   public final String customerName;
//   public final String email;
//   public final String address;
// 
//   public CustomerInformation(@JsonProperty("customerName") String customerName,
//                              @JsonProperty("email") String email,
//                              @JsonProperty("address") String address) {
//     this.customerName = customerName;
//     this.email = email;
//     this.address = address;
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderId.java
// public class OrderId extends GenericId {
// 
//   public OrderId(@JsonProperty("id") String id) {
//     super(id);
//   }
// 
//   public static OrderId randomId() {
//     return new OrderId(UUID.randomUUID().toString());
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderLine.java
// public class OrderLine extends TransportObject {
// 
//   public final ProductId productId;
//   public final String title;
//   public final int quantity;
//   public final long unitPrice;
// 
//   public OrderLine(@JsonProperty("productId") ProductId productId,
//                    @JsonProperty("title") String title,
//                    @JsonProperty("quantity") int quantity,
//                    @JsonProperty("unitPrice") long unitPrice) {
//     this.productId = productId;
//     this.title = title;
//     this.quantity = quantity;
//     this.unitPrice = unitPrice;
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderActivatedEvent.java
// public class OrderActivatedEvent extends DomainEvent<OrderId> {
// 
//   public OrderActivatedEvent(@JsonProperty("aggregateId") OrderId aggregateId,
//                              @JsonProperty("version") int version,
//                              @JsonProperty("timestamp") long timestamp) {
//     super(aggregateId, version, timestamp);
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderPlacedEvent.java
// public class OrderPlacedEvent extends DomainEvent<OrderId> {
// 
//   public final CustomerInformation customerInformation;
//   public final List<OrderLine> orderLines;
//   public final long orderAmount;
// 
//   public OrderPlacedEvent(@JsonProperty("aggregateId") OrderId id,
//                           @JsonProperty("version") int version,
//                           @JsonProperty("timestamp") long timestamp,
//                           @JsonProperty("customerInformation") CustomerInformation customerInformation,
//                           @JsonProperty("orderLines") List<OrderLine> orderLines,
//                           @JsonProperty("orderAmount") long orderAmount) {
//     super(id, version, timestamp);
//     this.customerInformation = customerInformation;
//     this.orderLines = Collections.unmodifiableList(orderLines);
//     this.orderAmount = orderAmount;
//   }
// 
// }


// Path: order-context-parent/order-query/src/test/java/se/citerus/cqrs/bookstore/ordercontext/query/orderlist/OrderListDenormalizerTest.java
import org.junit.Before;
import org.junit.Test;
import se.citerus.cqrs.bookstore.ordercontext.infrastructure.InMemOrderProjectionRepository;
import se.citerus.cqrs.bookstore.ordercontext.order.CustomerInformation;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderId;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderLine;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderActivatedEvent;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderPlacedEvent;
import java.util.Collections;
import java.util.Iterator;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static se.citerus.cqrs.bookstore.ordercontext.order.OrderStatus.ACTIVATED;

package se.citerus.cqrs.bookstore.ordercontext.query.orderlist;




public class OrderListDenormalizerTest {

  private OrderListDenormalizer denormalizer;

  @Before
  public void setUp() {