Testing is an essential part to ensure that the code, build their own test method is too slow, and not naming specification, idea provides a key building functional test structure ...
2. Step
1. needs to be done to test the class of the current window, direct shortcut keys: Press ctrl+shift+t
-> create new test
2. Select the method to execute
3. The test code generated as follows
4. If it is on a container (spring or springboot) tests, you need to add annotations
Code:
@RunWith(SpringRunner.class) @SpringBootTest @ContextConfiguration(classes = {APIApplication.class}) public class PddGoodsServiceImplTest { @Autowired private PddGoodsService pddGoodsService; @Test public void getGoodsById() { pddGoodsService.getGoodsById(456L); } @Test public void getGoodsList() { } @Test public void getGoodsUrl() { } }