2017-04-21 80 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(在測試文件夾下)嗎?