Java: Configure MockMvc Junit test for Spring Projects | Integration Testing in Spring | JAVA - Part HD
Для существования нашего сайта необходим показ рекламы. Просим отнестись с пониманием и добавить сайт в список исключений вашей программы для блокировки рекламы (AdBlock и другие).
12n.ru 18165 роликов
Configure MockMvc Junit test for Spring Projects | Integration Testing in Spring | JAVA - Part.
Namaste everyone,Today we have started learning spring integration testing for our spring projects.
This is the first part where we are configuring the MockMvc for the Junit test and just implemented the single Test function to check if we have configured correctly or not.Spring enabled test will run with the help of @RunWith(SpringJUnit4ClassRunner.class); the runner is essentially the entry-point to start using the Spring Test framework. @ContextConfiguration annotations to load the context configuration — I have used the XML configuration file but instead, if you want to use configuration class you can mention as:- @ContextConfiguration(classes = { ApplicationConfig.class })@WebAppConfiguration – which will load the web application context.In the next part, we will be adding tests for our views that how to test if your controller is returning the views only.Skip intro and can directly go to coding part:- 1:15Part2:-