@Test public void listArray() { PageableDTO pageableDTO = new PageableDTO(); pageableDTO.setLimit(10); pageableDTO.setOffset(0); List<Developer> developers = new ArrayList<>(); developers.add(developer); Mockito.when(developerRepository.findAll(Mockito.any(Example.class))).thenReturn(developers); List<Developer> developersResult = developerService.list(developerDTO); assertEquals(developers, developersResult); }
public DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO) { Developer developer = GenericConverter.mapper(developerDTO, Developer.class); Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Developer> page = developerRepository.findAll(example, pageable); DeveloperPage developerPage = new DeveloperPage(PageDTO.build(page)); return developerPage; }
DeveloperService { public DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO) { Developer developer = GenericConverter.mapper(developerDTO, Developer.class); Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Developer> page = developerRepository.findAll(example, pageable); DeveloperPage developerPage = new DeveloperPage(PageDTO.build(page)); return developerPage; } }
DeveloperService { public DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO) { Developer developer = GenericConverter.mapper(developerDTO, Developer.class); Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Developer> page = developerRepository.findAll(example, pageable); DeveloperPage developerPage = new DeveloperPage(PageDTO.build(page)); return developerPage; }  }
DeveloperService { public DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO) { Developer developer = GenericConverter.mapper(developerDTO, Developer.class); Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Developer> page = developerRepository.findAll(example, pageable); DeveloperPage developerPage = new DeveloperPage(PageDTO.build(page)); return developerPage; }  Developer find(Long id); Developer login(DeveloperLogin developerLogin); DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO); List<Developer> list(DeveloperDTO developerDTO); @Transactional Developer save(DeveloperDTO developerDTO); @Transactional Developer update(Long id, DeveloperDTO developerDTO); @Transactional void delete(Long id); }
DeveloperService { public DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO) { Developer developer = GenericConverter.mapper(developerDTO, Developer.class); Example<Developer> example = Example.of(developer, ExampleMatcher.matching().withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Developer> page = developerRepository.findAll(example, pageable); DeveloperPage developerPage = new DeveloperPage(PageDTO.build(page)); return developerPage; }  Developer find(Long id); Developer login(DeveloperLogin developerLogin); DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO); List<Developer> list(DeveloperDTO developerDTO); @Transactional Developer save(DeveloperDTO developerDTO); @Transactional Developer update(Long id, DeveloperDTO developerDTO); @Transactional void delete(Long id);  }