环境:
- Ubuntu 14.04
- Netbeans 8.0.2
- JUnit 4.12
Hi(测试类(
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class Hi {
@Test
public void hola(){
assertTrue(true);
}
}
pom.xml
...
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
...
对于Maven项目,测试类必须在src/test/java中,而不是src/main/java中。