「JUnit」- Java 单元测试框架

在 Junit 3 中,约定测试用例的方法都以 test 开头。在 JUnit 4 中,该命名约定得以延续;

in Maven

<project>
  ...
  <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>                                 // 表示该依赖仅对 test 有效,如果在其他目录引用 JUnit,将产生错误;
    </dependency>
  </dependencies>
  ...
</project>