Im trying to test a rest service that has @getmapping one param and PageableDefault
@GetMapping(path = "/api/{serial}/gender")
public ResponseEntity<?> task(
@PathVariable(value = "serial") String Serial,
@PageableDefault(size = 5, value = 0) Pageable pageable) {
return ResponseEntity.ok(page);
}
The test suite its with mockmvc
@Test
public void testTask() throws Exception {
String url ="/api/123456789/gender";
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(url))
.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
}
I got the following error , im unable to inject Pageable cause its a interface how can i mock the @pageable default ?
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: No primary or default constructor found for interface org.springframework.data.domain.Pageable