@Test public void testHandleCreated() throws Exception { FeeId feeId = new FeeId(); FeeStatus feeStatus = FeeStatus.PENDING; BigMoney amount = BigMoney.parse("BTC 30"); FeeType feeType = FeeType.PAY_COIN; Date dueDate = new Date(); Date businessCreationTime = new Date(); String portfolioId = "portfolioId"; String userId = "userId"; BusinessType businessType = BusinessType.CHARGE_COIN_COMMISSION; String businessReferenceId = "businessReferenceId"; AccountReceivableEntryListener listener = new AccountReceivableEntryListener(); AccountReceivableFeeEntryQueryRepository repository = mock(AccountReceivableFeeEntryQueryRepository.class); listener.setRepository(repository); AccountReceivableFeeCreatedEvent event = new AccountReceivableFeeCreatedEvent(feeId, feeStatus, amount, feeType, dueDate, businessCreationTime, portfolioId, userId, businessType, businessReferenceId); listener.handleCreated(event); ArgumentCaptor<AccountReceivableFeeEntry> captor = ArgumentCaptor.forClass(AccountReceivableFeeEntry.class); verify(repository).save(captor.capture()); AccountReceivableFeeEntry entity = captor.getValue(); assertThat(entity.getPrimaryKey(), equalTo(feeId.toString())); assertThat(entity.getFeeStatus(), is(FeeStatus.PENDING)); assertThat(entity.getAmount(), equalTo(amount)); assertThat(entity.getFeeType(), equalTo(feeType)); assertThat(entity.getDueDate(), equalTo(dueDate)); assertThat(entity.getBusinessCreationTime(), equalTo(businessCreationTime)); assertThat(entity.getPortfolioId(), equalTo(portfolioId)); assertThat(entity.getUserId(), equalTo(userId)); assertThat(entity.getBusinessType(), equalTo(businessType)); assertThat(entity.getBusinessReferenceId(), equalTo(businessReferenceId)); }
@EventHandler public void handleCreated(AccountReceivableFeeCreatedEvent event) { AccountReceivableFeeEntry entry = new AccountReceivableFeeEntry(); entry.copy(event); repository.save(entry); }
AccountReceivableEntryListener { @EventHandler public void handleCreated(AccountReceivableFeeCreatedEvent event) { AccountReceivableFeeEntry entry = new AccountReceivableFeeEntry(); entry.copy(event); repository.save(entry); } }
AccountReceivableEntryListener { @EventHandler public void handleCreated(AccountReceivableFeeCreatedEvent event) { AccountReceivableFeeEntry entry = new AccountReceivableFeeEntry(); entry.copy(event); repository.save(entry); }  }
AccountReceivableEntryListener { @EventHandler public void handleCreated(AccountReceivableFeeCreatedEvent event) { AccountReceivableFeeEntry entry = new AccountReceivableFeeEntry(); entry.copy(event); repository.save(entry); }  @EventHandler void handleCreated(AccountReceivableFeeCreatedEvent event); @EventHandler void handleConfirmed(AccountReceivableFeeConfirmedEvent event); @EventHandler void handleOffseted(AccountReceivableFeeOffsetedEvent event); @EventHandler void handleCancelled(AccountReceivableFeeCancelledEvent event); @Autowired @SuppressWarnings("SpringJavaAutowiringInspection") void setRepository(AccountReceivableFeeEntryQueryRepository repository); }
AccountReceivableEntryListener { @EventHandler public void handleCreated(AccountReceivableFeeCreatedEvent event) { AccountReceivableFeeEntry entry = new AccountReceivableFeeEntry(); entry.copy(event); repository.save(entry); }  @EventHandler void handleCreated(AccountReceivableFeeCreatedEvent event); @EventHandler void handleConfirmed(AccountReceivableFeeConfirmedEvent event); @EventHandler void handleOffseted(AccountReceivableFeeOffsetedEvent event); @EventHandler void handleCancelled(AccountReceivableFeeCancelledEvent event); @Autowired @SuppressWarnings("SpringJavaAutowiringInspection") void setRepository(AccountReceivableFeeEntryQueryRepository repository);  }