BaseMvcTest.java (678B)
1 package com.wimdupont.swagger.blueprint.controller; 2 3 import com.fasterxml.jackson.databind.ObjectMapper; 4 import org.junit.jupiter.api.BeforeEach; 5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.test.web.servlet.MockMvc; 7 import org.springframework.test.web.servlet.setup.MockMvcBuilders; 8 import org.springframework.web.context.WebApplicationContext; 9 10 abstract class BaseMvcTest { 11 protected MockMvc mvc; 12 @Autowired 13 protected ObjectMapper objectMapper; 14 @Autowired 15 private WebApplicationContext context; 16 17 @BeforeEach 18 void setUp() { 19 mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); 20 } 21 }