@Test public void handleSellTransactionCancelledEvent() { final Date time = currentTime(); TransactionEntry transactionEntry = new TransactionEntry(); transactionEntry.setPrimaryKey(transactionIdentifier.toString()); transactionEntry.setAmountOfExecutedItem(BigMoney.zero(CurrencyUnit.of(Currencies.BTC))); transactionEntry.setState(TransactionState.STARTED); transactionEntry.setAmountOfItem(DEFAULT_TOTAL_ITEMS); transactionEntry.setOrderBookIdentifier(orderBookIdentifier.toString()); transactionEntry.setPortfolioIdentifier(portfolioIdentifier.toString()); transactionEntry.setType(TransactionType.SELL); when(transactionQueryRepository.findOne(transactionIdentifier.toString())).thenReturn(transactionEntry); SellTransactionCancelledEvent event = new SellTransactionCancelledEvent( transactionIdentifier, coinIdentifier, time); listener.handleEvent(event); Mockito.verify(transactionQueryRepository).save(Matchers.argThat(new TransactionEntryMatcher( DEFAULT_TOTAL_ITEMS, BigMoney.zero(CurrencyUnit.of(Currencies.BTC)), DEFAULT_COIN_NAME, TransactionState.CANCELLED, TransactionType.SELL ))); }
@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);  }