class TransactionEventHandler {

    @EventHandler
    public void on(BuyTransactionStartedEvent event) {
        startTransaction(event, TransactionType.BUY);
    }

}

class TransactionEventHandlerTest {

    private static final int DEFAULT_TOTAL_ITEMS;
    private static final int DEFAULT_ITEM_PRICE;
    private static final String DEFAULT_COMPANY_NAME;
    private final OrderBookViewRepository orderBookViewRepository;
    private final TransactionViewRepository transactionViewRepository;
    private TransactionEventHandler testSubject;
    private final TransactionId transactionIdentifier;
    private final OrderBookId orderBookIdentifier;
    private final PortfolioId portfolioIdentifier;
    private final CompanyId companyIdentifier;

    @Test
    public void handleSellTransactionStartedEvent() {

        testSubject.on(new SellTransactionStartedEvent(transactionIdentifier,
                                                       orderBookIdentifier,
                                                       portfolioIdentifier,
                                                       DEFAULT_TOTAL_ITEMS,
                                                       DEFAULT_ITEM_PRICE));

        verify(transactionViewRepository).save(argThat(new TransactionEntryMatcher(
                DEFAULT_TOTAL_ITEMS, 0, DEFAULT_COMPANY_NAME, DEFAULT_ITEM_PRICE, STARTED, SELL
        )));
    }

}