@RunWith(SpringRunner.class)
@SpringBootTest(classes = XXXApplication.class)
package com.tky.gcjgfj.myTest;
import com.tky.GcjgfjPlatformApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = GcjgfjPlatformApplication.class)
public class Demo {
@Test
public void test() {
System.err.println("test");
}
}
- 不加public会报错:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a9bf1b3313185c01b32d81f73a847694.png)