I have a very simple unit test:
@RunWith(MockitoJUnitRunner.class)
public class RestControllerTest {
protected MockMvc mockMvc;
@Autowired
WebApplicationContext wac;
@InjectMocks
protected RestController restController;
@Mock
protected UserService mockUserService;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
}
I am stuck at figuring out how to Autowire WebApplicationContext in the above test. Please can somebody guide me how to do this.
P.S. I am using MockitoJUnitRunner I am not sure if this makes a difference or no. But I am new to Spring and Mockito so dont know much about either technologies.