package com.lesson.maven.model;
public class HelloWorld{
public String sayHello(){
return "Hello World!";
}
}
package com.lesson.maven.model;
import org.junit.*;
import org.junit.Assert.*;
public class HelloWorldTest{
@Test
public void testHello(){
Assert.assertEquals("Hello World!",new HelloWorld.sayHello());
}
}
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
<groupId>com.lesson.maven</groupId>
<artifactId>maven-model</artifactId>
<version>0.0.1SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
</dependencies>
运行成功截图:
测试失败截图:
求解惑,不胜感激!