1. First correct installation and configuration of environment variables;
2. Then create your own HelloWorld, where I'll name it 1.0;
3. Run the project and test it;
4. Package the HelloWorld in the catalog to view;
5. Download the Junit.jar and add a new path to the environment variable;
6. Modify the source code after the test;
You can see that the test was successful!
Attach Source code:
Main
Package com. helloworld.app;/** * Hello world! * */public class App {public static void Main (string[] args) { app app = new app (); System.out.println ("Hello tan!"); } Public String Sayapp () { return "Hello tan!"; }}
Test
Package com. Helloworld.app;import Junit.framework.test;import Junit.framework.*;import Junit.framework.testsuite;import java.io.*;/** * Unit test for simple App. */public class Apptest extends testcase{ /** * Create the test case< c3/>* * @param testname name of the the test case * /Public apptest (String testname) { super (testname) ; } /** * @return The suite of tests being tested * * Public static Test suite () { return new Testsuit E (Apptest.class); } /** * rigourous Test:-) * /public void testApp () { app app = new com. HELLOWORLD.APP.APP (); Assertequals ("Hello tan!", App.sayapp ());} }
Getting Started with Maven