@Test public void testSellTransactionCancelled() throws Exception { final Date time = currentTime(); final TransactionEntry entry = new TransactionEntry(); entry.setState(TransactionState.STARTED); when(transactionQueryRepository.findOne(eq(transactionIdentifier.toString()))) .thenReturn(entry); final SellTransactionCancelledEvent event = new SellTransactionCancelledEvent(transactionIdentifier, coinIdentifier, time); listener.handleEvent(event); ArgumentCaptor<TransactionEntry> captor = ArgumentCaptor.forClass(TransactionEntry.class); verify(transactionQueryRepository).save(captor.capture()); final TransactionEntry saved = captor.getValue(); assertThat(saved, notNullValue()); assertThat(saved.getState(), equalTo(TransactionState.CANCELLED)); }
@EventHandler public void handleEvent(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); }
TransactionEventListener { @EventHandler public void handleEvent(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); } }
TransactionEventListener { @EventHandler public void handleEvent(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); }  }
TransactionEventListener { @EventHandler public void handleEvent(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); }  @EventHandler void handleEvent(BuyTransactionStartedEvent event); @EventHandler void handleEvent(SellTransactionStartedEvent event); @EventHandler void handleEvent(BuyTransactionCancelledEvent event); @EventHandler void handleEvent(SellTransactionCancelledEvent event); @EventHandler void handleEvent(BuyTransactionConfirmedEvent event); @EventHandler void handleEvent(SellTransactionConfirmedEvent event); @EventHandler void handleEvent(BuyTransactionExecutedEvent event); @EventHandler void handleEvent(SellTransactionExecutedEvent event); @EventHandler void handleEvent(BuyTransactionPartiallyExecutedEvent event); @EventHandler void handleEvent(SellTransactionPartiallyExecutedEvent event); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setOrderBookQueryRepository(OrderBookQueryRepository orderBookQueryRepository); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setTransactionQueryRepository(TransactionQueryRepository transactionQueryRepository); }
TransactionEventListener { @EventHandler public void handleEvent(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); }  @EventHandler void handleEvent(BuyTransactionStartedEvent event); @EventHandler void handleEvent(SellTransactionStartedEvent event); @EventHandler void handleEvent(BuyTransactionCancelledEvent event); @EventHandler void handleEvent(SellTransactionCancelledEvent event); @EventHandler void handleEvent(BuyTransactionConfirmedEvent event); @EventHandler void handleEvent(SellTransactionConfirmedEvent event); @EventHandler void handleEvent(BuyTransactionExecutedEvent event); @EventHandler void handleEvent(SellTransactionExecutedEvent event); @EventHandler void handleEvent(BuyTransactionPartiallyExecutedEvent event); @EventHandler void handleEvent(SellTransactionPartiallyExecutedEvent event); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setOrderBookQueryRepository(OrderBookQueryRepository orderBookQueryRepository); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired void setTransactionQueryRepository(TransactionQueryRepository transactionQueryRepository);  }