https://kotlinlang.org logo
#spring
Title
# spring
a

andyb

04/27/2018, 8:16 AM
Thanks, tried that & ended up with different errors, think I have created a sort of hybrid Unit Test. Will probably just go with the manual creation of the MockMvc for the time being as it allows me to test the controller interface whilst mocking out the backing services.
s

sandjelkovic

04/27/2018, 8:20 AM
You can setup it as an integration test and use @MockBean on all the beans that the controller is depending on. Beans annotated with MockBean are Mockito beans injected into the Context.
a

andyb

04/27/2018, 8:22 AM
I am looking to keep it as lightweight as possible & don't want to spin up a whole Spring Boot context if I can help it.
m

Michael

04/27/2018, 1:46 PM
@WebMvcTest only does the base context, the webmvc config, security, and serialization (enough to “hit the endpoints with all their magic)
4 Views