paquete de guía
<! -测试->
<dependency>
<groupId> org.springframework.boot </ groupId>
<artifactId> resorte de arranque-motor de arranque de la prueba </ artifactId>
</ dependency>
El cursor sobre el nombre de la clase, el atajo Alt + Enter
com.company.mapper empaquetar;
com.company.pojo.User importación;
org.junit.Test importación;
org.junit.runner.RunWith importación;
org.springframework.beans.factory.annotation.Autowired importación;
org.springframework.boot.test.context.SpringBootTest importación;
org.springframework.test.context.junit4.SpringRunner importación;
importar org.junit.jupiter.api.Assertions estáticas. *;
//加上这两个注解,运行测试方法的时候就会启动SpringBoot
@RunWith (SpringRunner.class)
@SpringBootTest
public class {UserMapperTest
@Autowired
asignador UserMapper privado;
@Test
TESTUSER public void () {
System.out.println (mapper.selectByPrimaryKey (1));
}
}