### Question:
AisConsentUsageService { @Transactional public void resetUsage(ConsentEntity consent) { List<AisConsentUsage> aisConsentUsageList = aisConsentUsageRepository.findReadByConsentAndUsageDate(consent, LocalDate.now()); aisConsentUsageList.forEach(acu -> acu.setUsage(0)); aisConsentUsageRepository.saveAll(aisConsentUsageList); }  @Transactional void incrementUsage(ConsentEntity consent, AisConsentActionRequest request); @Transactional void resetUsage(ConsentEntity consent); @Transactional Map<String, Integer> getUsageCounterMap(ConsentEntity consent);  }### Answer:
@Test void resetUsage() { @SuppressWarnings("unchecked") ArgumentCaptor<List<AisConsentUsage>> argumentCaptor = ArgumentCaptor.forClass(List.class); ConsentEntity consentEntity = new ConsentEntity(); List<AisConsentUsage> aisConsentUsageList = Arrays.asList(buildAisConsentUsage(5), buildAisConsentUsage(8), buildAisConsentUsage(10)); when(aisConsentUsageRepository.findReadByConsentAndUsageDate(eq(consentEntity), any(LocalDate.class))).thenReturn(aisConsentUsageList); aisConsentUsageService.resetUsage(consentEntity); verify(aisConsentUsageRepository).saveAll(argumentCaptor.capture()); List<AisConsentUsage> aisConsentUsageListCaptured = argumentCaptor.getValue(); assertEquals(aisConsentUsageList.size(), aisConsentUsageListCaptured.size()); assertEquals(aisConsentUsageList.size(), aisConsentUsageListCaptured.stream().map(AisConsentUsage::getUsage).filter(usage -> usage == 0).count()); }