ProductService { @Transactional public Page<Product> getProductList(int startPage) { Pageable pageable = PageRequest.of(startPage, pageSize); Page<Product> products = productRepository.findProducts(pageable); return products; } ProductService(ProductRepository productRepository); @Transactional Page<Product> getProductList(int startPage); @Transactional Page<Product> getProductList(Long superiorId, int start); @Transactional Page<Product> getProductList(String searchWord, int start);  }
@Test public void 모든_품목_불러오기() { System.out.println("모든 품목 불러오기 시작"); Page<Product> products = productService.getProductList(0); for (Product product : products) { System.out.println(product.toString()); } }
@Test public void 상위카테고리id로_품목_목록_불러오기() { System.out.println("상위카테고리id로_품목_목록_불러오기 시작"); Page<Product> products = productService.getProductList(1L, 0); for (Product product : products) { System.out.println(product.toString()); } }