JUnit

A programmer-oriented testing framework for Java.

http://junit.org/

Annotations

Imports

   1 import static org.junit.Assert.assertEquals;
   2 import org.junit.Test;
   3 import org.junit.Ignore;
   4 import org.junit.runner.RunWith;
   5 import org.junit.runners.JUnit4;

Inclusion classes

http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

By default, the Surefire Plugin will automatically include all test classes with the following wildcard patterns:

"**/Test*.java" - includes all of its subdirectories and all java filenames that start with "Test".
"**/*Test.java" - includes all of its subdirectories and all java filenames that end with "Test".
"**/*TestCase.java" - includes all of its subdirectories and all java filenames that end with "TestCase".

Import methods

   1  import static org.junit.Assert.*;
   2   //  ...
   3   assertEquals(...);

Maven dependency

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
</dependency>  

Java/JUnit (last edited 2014-11-02 14:42:27 by 145)