@Test public void testHandleConfirmed() throws Exception { FeeId feeId = new FeeId("primaryKey"); Date confirmedDate = new Date(); ReceivedFeeEntryListener listener = new ReceivedFeeEntryListener(); ReceivedFeeEntryQueryRepository repository = mock(ReceivedFeeEntryQueryRepository.class); when(repository.findOne(eq("primaryKey"))).thenReturn(new ReceivedFeeEntry()); listener.setRepository(repository); ReceivedFeeConfirmedEvent event = new ReceivedFeeConfirmedEvent(feeId, BigMoney.parse("BTC 540.098"), confirmedDate); listener.handleConfirmed(event); ArgumentCaptor<ReceivedFeeEntry> captor = ArgumentCaptor.forClass(ReceivedFeeEntry.class); verify(repository).save(captor.capture()); ReceivedFeeEntry entity = captor.getValue(); assertThat(entity.getConfirmedDate(), equalTo(confirmedDate)); assertThat(entity.getFeeStatus(), is(FeeStatus.CONFIRMED)); assertThat(entity.getAmount(), equalTo(BigMoney.parse("BTC 540.098"))); }
@EventHandler public void handleConfirmed(ReceivedFeeConfirmedEvent event) { final ReceivedFeeEntry entry = repository.findOne(event.getFeeId().toString()); if (entry == null) { logger.error("Entry not found with id {}", event.getFeeId()); } entry.setConfirmedDate(event.getConfirmedDate()); entry.setFeeStatus(FeeStatus.CONFIRMED); entry.setAmount(event.getAmount()); repository.save(entry); }
ReceivedFeeEntryListener { @EventHandler public void handleConfirmed(ReceivedFeeConfirmedEvent event) { final ReceivedFeeEntry entry = repository.findOne(event.getFeeId().toString()); if (entry == null) { logger.error("Entry not found with id {}", event.getFeeId()); } entry.setConfirmedDate(event.getConfirmedDate()); entry.setFeeStatus(FeeStatus.CONFIRMED); entry.setAmount(event.getAmount()); repository.save(entry); } }
ReceivedFeeEntryListener { @EventHandler public void handleConfirmed(ReceivedFeeConfirmedEvent event) { final ReceivedFeeEntry entry = repository.findOne(event.getFeeId().toString()); if (entry == null) { logger.error("Entry not found with id {}", event.getFeeId()); } entry.setConfirmedDate(event.getConfirmedDate()); entry.setFeeStatus(FeeStatus.CONFIRMED); entry.setAmount(event.getAmount()); repository.save(entry); }  }
ReceivedFeeEntryListener { @EventHandler public void handleConfirmed(ReceivedFeeConfirmedEvent event) { final ReceivedFeeEntry entry = repository.findOne(event.getFeeId().toString()); if (entry == null) { logger.error("Entry not found with id {}", event.getFeeId()); } entry.setConfirmedDate(event.getConfirmedDate()); entry.setFeeStatus(FeeStatus.CONFIRMED); entry.setAmount(event.getAmount()); repository.save(entry); }  @EventHandler void handleCreated(ReceivedFeeCreatedEvent event); @EventHandler void handleConfirmed(ReceivedFeeConfirmedEvent event); @EventHandler void handleOffseted(ReceivedFeeOffsetedEvent event); @EventHandler void handleCancelled(ReceivedFeeCancelledEvent event); @Autowired @SuppressWarnings("SpringJavaAutowiringInspection") void setRepository(ReceivedFeeEntryQueryRepository repository); }
ReceivedFeeEntryListener { @EventHandler public void handleConfirmed(ReceivedFeeConfirmedEvent event) { final ReceivedFeeEntry entry = repository.findOne(event.getFeeId().toString()); if (entry == null) { logger.error("Entry not found with id {}", event.getFeeId()); } entry.setConfirmedDate(event.getConfirmedDate()); entry.setFeeStatus(FeeStatus.CONFIRMED); entry.setAmount(event.getAmount()); repository.save(entry); }  @EventHandler void handleCreated(ReceivedFeeCreatedEvent event); @EventHandler void handleConfirmed(ReceivedFeeConfirmedEvent event); @EventHandler void handleOffseted(ReceivedFeeOffsetedEvent event); @EventHandler void handleCancelled(ReceivedFeeCancelledEvent event); @Autowired @SuppressWarnings("SpringJavaAutowiringInspection") void setRepository(ReceivedFeeEntryQueryRepository repository);  }