今天自己做练习的时候发现junit的@Test注解无法用。发现原因是junit的@Test注解默认配置是只能在名称为test的目录下面使用,改一下配置就好了。如下图
去掉图中箭头标注的scope一行就行了。改完后的配置如下。
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>