@Test void handle_updateLastModifiedDate() { final long requestId = 6578L; final RequestFundedEvent event = RequestFundedEvent.builder().requestId(requestId).build(); final Request request = RequestMother.fundRequestArea51() .withLastModifiedDate(LocalDateTime.now().minusWeeks(3)) .build(); when(requestRepository.findOne(requestId)).thenReturn(Optional.of(request)); handler.handle(event); assertThat(request.getLastModifiedDate()).isEqualToIgnoringSeconds(LocalDateTime.now()); verify(requestRepository).saveAndFlush(request); }
@EventListener public void handle(final RequestFundedEvent event) { final Request request = requestRepository.findOne(event.getRequestId()) .orElseThrow(() -> new RuntimeException("Unable to find request")); request.setLastModifiedDate(LocalDateTime.now()); requestRepository.saveAndFlush(request); }
UpdateRequestLastModifiedDateOnFundedHandler { @EventListener public void handle(final RequestFundedEvent event) { final Request request = requestRepository.findOne(event.getRequestId()) .orElseThrow(() -> new RuntimeException("Unable to find request")); request.setLastModifiedDate(LocalDateTime.now()); requestRepository.saveAndFlush(request); } }
UpdateRequestLastModifiedDateOnFundedHandler { @EventListener public void handle(final RequestFundedEvent event) { final Request request = requestRepository.findOne(event.getRequestId()) .orElseThrow(() -> new RuntimeException("Unable to find request")); request.setLastModifiedDate(LocalDateTime.now()); requestRepository.saveAndFlush(request); } UpdateRequestLastModifiedDateOnFundedHandler(final RequestRepository requestRepository); }
UpdateRequestLastModifiedDateOnFundedHandler { @EventListener public void handle(final RequestFundedEvent event) { final Request request = requestRepository.findOne(event.getRequestId()) .orElseThrow(() -> new RuntimeException("Unable to find request")); request.setLastModifiedDate(LocalDateTime.now()); requestRepository.saveAndFlush(request); } UpdateRequestLastModifiedDateOnFundedHandler(final RequestRepository requestRepository); @EventListener void handle(final RequestFundedEvent event); }
UpdateRequestLastModifiedDateOnFundedHandler { @EventListener public void handle(final RequestFundedEvent event) { final Request request = requestRepository.findOne(event.getRequestId()) .orElseThrow(() -> new RuntimeException("Unable to find request")); request.setLastModifiedDate(LocalDateTime.now()); requestRepository.saveAndFlush(request); } UpdateRequestLastModifiedDateOnFundedHandler(final RequestRepository requestRepository); @EventListener void handle(final RequestFundedEvent event);  }