2017-04-21 73 views
0

我正在写Spring Boot REST服务器。Spring Boot Paging not working

这是我TripController.java

@RequestMapping(path = "/", method = RequestMethod.GET) 
public GenericResponse<List<Trip>> getUserTrips(@RequestParam("owner") String owner) { 
    Pageable pageRequest = createPageRequest(); 
    List<Trip> trips = tripRepository.findByOwner(owner , pageRequest); 
    return new GenericResponse<List<Trip>>(200, "Success", trips); 
} 

private Pageable createPageRequest() 
    return new PageRequest(0, 10); 
} 

在编译时,测试阶段我得到这个错误:

org.apache.maven.lifecycle.LifecycleExecutionException:未能执行目标org.apache .maven.plugins:maven-surefire-plugin:2.18.1:项目演示测试(默认测试):测试失败。

完整的错误报告是在这里:https://pastebin.com/s4u5RX51

回答

0

问题不分页,问题是它无法连接到数据库在运行测试套件。 你可以粘贴你的POM文件以及你的application.properties(在测试文件夹下)吗?