TraceService { public LogTraceDTOPage find(List<FiltersDTO> filtersDTOS, PageableDTO pageableDTO) { Page<LogTrace> page = mongoConnection.find(filtersDTOS, pageableDTO.getOffset(), pageableDTO.getLimit()); Page<LogTraceDTO> response = createPagedResponse(page); return new LogTraceDTOPage(PageDTO.build(response)); }  @Transactional(readOnly = true) LogTraceDTO findById(String id); LogTraceDTOPage find(List<FiltersDTO> filtersDTOS, PageableDTO pageableDTO);  }
@Test public void find() { Page<LogTrace> page = new Page<>(); List<LogTrace> logTraces = new ArrayList<>(); logTraces.add(logTrace); page.setContent(logTraces); page.setHasContent(true); page.setHasNextPage(false); page.setTotalElements(1); page.setTotalPages(1); page.setNumberOfElements(1); Mockito.when(mongoLogConnector.find(Mockito.anyListOf(FiltersDTO.class), Mockito.anyInt(), Mockito.anyInt())).thenReturn(page); PageableDTO pageableDTO = new PageableDTO(); pageableDTO.setOffset(0); pageableDTO.setLimit(10); LogTraceDTOPage logTraceDTOPage = traceService.find(new ArrayList<>(), pageableDTO); assertEquals(logTraces.get(0).getTrace(), logTraceDTOPage.getContent().get(0).getTrace()); }