@Test public void testHandleEvent() { OrderPlacedEvent book1 = createOrder(2013, 1, 1); OrderPlacedEvent book2 = createOrder(2013, 1, 2); OrderPlacedEvent book3 = createOrder(2013, 1, 2); ordersPerDayAggregator.handleEvent(book1); ordersPerDayAggregator.handleEvent(book2); ordersPerDayAggregator.handleEvent(book3); assertThat(ordersPerDayAggregator.getOrdersPerDay().toString(), is("{2013-01-01=1, 2013-01-02=2}")); }
@Subscribe public void handleEvent(OrderPlacedEvent event) { LocalDate localDate = new LocalDate(event.timestamp); Integer ordersPerDay = orders.get(localDate); orders.put(localDate, nullSafeIncrease(ordersPerDay)); }
OrdersPerDayAggregator implements DomainEventListener { @Subscribe public void handleEvent(OrderPlacedEvent event) { LocalDate localDate = new LocalDate(event.timestamp); Integer ordersPerDay = orders.get(localDate); orders.put(localDate, nullSafeIncrease(ordersPerDay)); } }
OrdersPerDayAggregator implements DomainEventListener { @Subscribe public void handleEvent(OrderPlacedEvent event) { LocalDate localDate = new LocalDate(event.timestamp); Integer ordersPerDay = orders.get(localDate); orders.put(localDate, nullSafeIncrease(ordersPerDay)); }  }
OrdersPerDayAggregator implements DomainEventListener { @Subscribe public void handleEvent(OrderPlacedEvent event) { LocalDate localDate = new LocalDate(event.timestamp); Integer ordersPerDay = orders.get(localDate); orders.put(localDate, nullSafeIncrease(ordersPerDay)); }  @Subscribe void handleEvent(OrderPlacedEvent event); @Override boolean supportsReplay(); Map<LocalDate, Integer> getOrdersPerDay(); }
OrdersPerDayAggregator implements DomainEventListener { @Subscribe public void handleEvent(OrderPlacedEvent event) { LocalDate localDate = new LocalDate(event.timestamp); Integer ordersPerDay = orders.get(localDate); orders.put(localDate, nullSafeIncrease(ordersPerDay)); }  @Subscribe void handleEvent(OrderPlacedEvent event); @Override boolean supportsReplay(); Map<LocalDate, Integer> getOrdersPerDay();  }