I have a restcontroller inside a spring-application returning a list of objects...
@GetMapping
@Override
public ResponseEntity readAll(@QuerydslPredicate(root = Entity.class) Predicate predicate, Pageable pageable){
...
}
If I run it, everything works fine. I can filter the request by pageable and predicate. But if I run the junit test, it fails...
@Test
public void readAllTest(){
MockMvcBuilders.standaloneSetup(*myController*)
.build().perform(MockMvcRequestBuilders.get(*myUri*)
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE)
)
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
Getting the following Errormessage... org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: No primary or default constructor found for interface com.querydsl.core.types.Predicate
Does anybody know how to test a restcontroller with a Pageable and Predicate?