go to directory that have .pom

write this line

mvn -Dtest=TestApp1#testPrintHelloWorld test


package com.core;
 
public class App {
	public static void main(String[] args) {
 
		System.out.println(getHelloWorld());
 
	}
 
	public static String getHelloWorld() {
 
		return "Hello World";
 
	}
 
	public static String getHelloWorld2() {
 
		return "Hello World 2";
 
	}
}


package com.core;
 
import junit.framework.Assert;
import org.junit.Test;
 
public class TestApp1 {
 
	@Test
	public void testPrintHelloWorld() {
 
		Assert.assertEquals(App.getHelloWorld(), "Hello World");
 
	}
 
}


http://maven.apache.org/index.html