sayHello.java

/*************************************************************************
    > File Name: helloMaven.java
    > Author: frank
    > Mail: acmerli@hotmail.com 
    > Created Time: 2015年06月29日 星期一 17时13分45秒
 ************************************************************************/
package com.frank.Maven;
public class sayHello{
    public String say(String name){
        return "Hello"+name;
    }
}

TestHello.java

/*************************************************************************
    > File Name: TestHello.java
    > Author: frank
    > Mail: acmerli@hotmail.com 
    > Created Time: 2015年06月29日 星期一 17时17分50秒
 ************************************************************************/
package com.frank.test;
import org.junit.*;
import com.frank.Maven.*;
import static org.junit.Assert.*;
public class TestHello{
    @Test
    public void testhello(){
        sayHello say=new sayHello();
        String str=say.say("frank");
        assertEquals(str,"Hellofrank");
    }
}

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.frank.Maven</groupId>
      <artifactId>helloMaven</artifactId>
      <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
        </dependency>
    </dependencies>
 </project>