@Test public void handleSellTransactionStartedEvent() { final Date time = currentTime(); SellTransactionStartedEvent event = new SellTransactionStartedEvent(transactionIdentifier, coinIdentifier, orderBookIdentifier, portfolioIdentifier, DEFAULT_TOTAL_ITEMS, DEFAULT_ITEM_PRICE, DEFAULT_TOTAL_MONEY, DEFAULT_SELL_COMMISSION, 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.getAmountOfItem(), equalTo(DEFAULT_TOTAL_ITEMS)); assertThat(saved.getTotalCommission(), equalTo(DEFAULT_SELL_COMMISSION)); assertThat(saved.getTotalMoney(), equalTo(DEFAULT_TOTAL_MONEY)); assertThat(saved.getPrimaryKey(), equalTo(transactionIdentifier.toString())); assertThat(saved.getOrderBookIdentifier(), equalTo(orderBookIdentifier.toString())); assertThat(saved.getPortfolioIdentifier(), equalTo(portfolioIdentifier.toString())); assertThat(saved.getCoinId(), equalTo(coinIdentifier.toString())); assertThat(saved.getState(), equalTo(TransactionState.STARTED)); assertThat(saved.getType(), equalTo(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);  }