### Question:
RequestVacuumer { @Scheduled(fixedDelay = 300_000L) public void cleanRefunds() { final List<RefundRequest> refundRequests = refundRequestRepository.findAllByStatus(RefundRequestStatus.APPROVED); refundRequests.stream() .filter(refundRequest -> refundRequest.getTransactionHash() != null) .filter(refundRequest -> azraelClient.getTransactionStatus(refundRequest.getTransactionHash()).equals(TransactionStatus.FAILED)) .forEach(refundRequest -> { refundRequest.setStatus(RefundRequestStatus.TRANSACTION_FAILED); refundRequestRepository.save(refundRequest); }); } RequestVacuumer(final RequestClaimRepository requestClaimRepository,
                           final RefundRequestRepository refundRequestRepository,
                           final AzraelClient azraelClient); @Scheduled(fixedDelay = 300_000L) void cleanClaims(); @Scheduled(fixedDelay = 300_000L) void cleanRefunds();  }### Answer:
@Test void cleanRefunds() { final RefundRequest refundRequest1 = RefundRequest.builder().status(RefundRequestStatus.APPROVED).transactionHash("0x213").build(); final RefundRequest refundRequest2 = RefundRequest.builder().status(RefundRequestStatus.APPROVED).transactionHash("0x3243").build(); final RefundRequest refundRequest3 = RefundRequest.builder().status(RefundRequestStatus.APPROVED).transactionHash(null).build(); final RefundRequest refundRequest4 = RefundRequest.builder().status(RefundRequestStatus.APPROVED).transactionHash("0x687").build(); when(refundRequestRepository.findAllByStatus(RefundRequestStatus.APPROVED)).thenReturn(Arrays.asList(refundRequest1, refundRequest2, refundRequest3, refundRequest4)); when(azraelClient.getTransactionStatus(refundRequest1.getTransactionHash())).thenReturn(TransactionStatus.SUCCEEDED); when(azraelClient.getTransactionStatus(refundRequest2.getTransactionHash())).thenReturn(TransactionStatus.NOT_FOUND); when(azraelClient.getTransactionStatus(refundRequest4.getTransactionHash())).thenReturn(TransactionStatus.FAILED); requestVacuumer.cleanRefunds(); assertThat(refundRequest1.getStatus()).isEqualTo(RefundRequestStatus.APPROVED); assertThat(refundRequest2.getStatus()).isEqualTo(RefundRequestStatus.APPROVED); assertThat(refundRequest3.getStatus()).isEqualTo(RefundRequestStatus.APPROVED); assertThat(refundRequest4.getStatus()).isEqualTo(RefundRequestStatus.TRANSACTION_FAILED); verify(refundRequestRepository).findAllByStatus(RefundRequestStatus.APPROVED); verify(refundRequestRepository).save(refundRequest4); verifyNoMoreInteractions(refundRequestRepository); }