AuditServiceImpl implements AuditService { @Override public List<HistoryDto> findLegalHistoryDetails(List<Number> revisions) { List<HistoryDto> historyDtos = makeHistoryDtos(); for (Number n : revisions) { HistoryDto hd = findLegalHistoryDetail(n); historyDtos.add(hd); } return historyDtos; } AuditServiceImpl(
			EntityManagerFactory entityManagerFactory,
			PatientRepository patientRepository,
			RevisionInfoEntityRepository patientRevisionEntityRepository,
			ModifiedEntityTypeEntityRepository modifiedEntityTypeEntityRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			StaffRepository staffRepository); @Override List<HistoryDto> findAllHistory(String username); @Override List<HistoryDto> getReversed(List<HistoryDto> original); @Override List<HistoryDto> findHistoryDetails(List<Number> revisions); @Override List<HistoryDto> makeHistoryDtos(); @Override HistoryDto makeHistoryDto(); @Override HistoryDto findHistoryDetail(Number n); List<HistoryDto> findConsentRevokationHistoryByPatient(
			AuditReader reader, long patientId); List<HistoryDto> findConsentSignPDFHistoryByPatient(
			AuditReader reader, long patientId); @Override String findRevType(
			List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys); @Override String findRevType(Byte btype); @Override String findRevClassName(
			List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys); @Override List<HistoryDto> findLegalHistoryByPatient(long patientId); @Override List<HistoryDto> findLegalHistoryDetails(List<Number> revisions); @Override HistoryDto findLegalHistoryDetail(Number n);  }
@Test public void testFindLegalHistoryDetails() { List<Number> revisions = new ArrayList<Number>(); for (int i = 0; i < 3; i++) { revisions.add(i); } AuditService pasutSpy = spy(pasut); List<HistoryDto> historyDtosList = new ArrayList<HistoryDto>(); List<HistoryDto> historyDtosListSpy = spy(historyDtosList); when(pasutSpy.makeHistoryDtos()).thenReturn(historyDtosListSpy); pasutSpy.findHistoryDetails(revisions); verify(historyDtosListSpy, times(3)).add(any(HistoryDto.class)); }