Junit 5

dependency

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-test</artifactId>
  4. <scope>test</scope>
  5. </dependency>

useage

shortcut key ctrl+shift+tin IDEA will create a new test in test scope folder

  1. @SpringBootTest
  2. class TestControllerTest {
  3. @Autowired
  4. private TestController testController;
  5. @Test
  6. public void test1() {
  7. testController.testQuery();
  8. }
  9. }

Junit 4

to be continue