@WebMvcTest equivalent for Spring Data Rest repositories [DATAREST-1082]
Trevor Smith opened DATAREST-1082 and commented
I think it would be really useful to have a test annotation that functions similar to @WebMvcTest but for Spring Data Rest repositories. Currently the only way I know to test these repositories is to start the entire application using @SpringBootTest.
The annotation could be similar to
@RestRepositoryTest(repositories = <List of repositories to test>)
The annotation would allow for testing of the exposed REST resources using MockMvc
4 votes, 5 watchers
Mike Whittemore commented
I'd really like to be able to use @WebMvcTest or an equivalent of it where I can mock the repository. With Spring Data Rest I can already write isolated persistence tests on the repository layer using the @Data<X>Test annotation. I'd like the equivalent for the controller layer so I can test the controller behavior in isolation (e.g. isolated from the persistence functionality)
I would also use such solution. Tests would be much faster and more readable compared to using @SpringBootTest.