@Test public void testOnSellTransactionStartedEventSavesTransactionView() { int expectedAmountOfExecutedItems = 0; SellTransactionStartedEvent testEvent = new SellTransactionStartedEvent( transactionId, orderBookId, portfolioId, DEFAULT_TOTAL_ITEMS, DEFAULT_ITEM_PRICE ); testSubject.on(testEvent); verify(transactionViewRepository).save(transactionViewCaptor.capture()); TransactionView result = transactionViewCaptor.getValue(); assertEquals(transactionId.getIdentifier(), result.getIdentifier()); assertEquals(orderBookId.getIdentifier(), result.getOrderBookId()); assertEquals(portfolioId.getIdentifier(), result.getPortfolioId()); assertEquals(DEFAULT_COMPANY_NAME, result.getCompanyName()); assertEquals(DEFAULT_TOTAL_ITEMS, result.getAmountOfItems()); assertEquals(expectedAmountOfExecutedItems, result.getAmountOfExecutedItems()); assertEquals(DEFAULT_ITEM_PRICE, result.getPricePerItem()); assertEquals(TransactionState.STARTED, result.getState()); assertEquals(TransactionType.SELL, result.getType()); }
@EventHandler public void on(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); }
TransactionEventHandler { @EventHandler public void on(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); } }
TransactionEventHandler { @EventHandler public void on(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); } TransactionEventHandler(OrderBookViewRepository orderBookViewRepository,
                                   TransactionViewRepository transactionViewRepository); }
TransactionEventHandler { @EventHandler public void on(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); } TransactionEventHandler(OrderBookViewRepository orderBookViewRepository,
                                   TransactionViewRepository transactionViewRepository); @EventHandler void on(BuyTransactionStartedEvent event); @EventHandler void on(SellTransactionStartedEvent event); @EventHandler void on(BuyTransactionCancelledEvent event); @EventHandler void on(SellTransactionCancelledEvent event); @EventHandler void on(BuyTransactionConfirmedEvent event); @EventHandler void on(SellTransactionConfirmedEvent event); @EventHandler void on(BuyTransactionExecutedEvent event); @EventHandler void on(SellTransactionExecutedEvent event); @EventHandler void on(BuyTransactionPartiallyExecutedEvent event); @EventHandler void on(SellTransactionPartiallyExecutedEvent event); @QueryHandler TransactionView find(TransactionByIdQuery query); @QueryHandler List<TransactionView> find(TransactionsByPortfolioIdQuery query); }
TransactionEventHandler { @EventHandler public void on(BuyTransactionStartedEvent event) { startTransaction(event, TransactionType.BUY); } TransactionEventHandler(OrderBookViewRepository orderBookViewRepository,
                                   TransactionViewRepository transactionViewRepository); @EventHandler void on(BuyTransactionStartedEvent event); @EventHandler void on(SellTransactionStartedEvent event); @EventHandler void on(BuyTransactionCancelledEvent event); @EventHandler void on(SellTransactionCancelledEvent event); @EventHandler void on(BuyTransactionConfirmedEvent event); @EventHandler void on(SellTransactionConfirmedEvent event); @EventHandler void on(BuyTransactionExecutedEvent event); @EventHandler void on(SellTransactionExecutedEvent event); @EventHandler void on(BuyTransactionPartiallyExecutedEvent event); @EventHandler void on(SellTransactionPartiallyExecutedEvent event); @QueryHandler TransactionView find(TransactionByIdQuery query); @QueryHandler List<TransactionView> find(TransactionsByPortfolioIdQuery query);  }