标签:
public class Main { public String sayHello() { return "Hello ZhangKexin!"; } public static void main(String[] args) { HelloWorld helloWorld = new HelloWorld(); System.out.println(helloWorld.Hello()); } }
public class HelloWorld { public String Hello() { return "Hello Xu Luhan"; } public static void main(String[] args) { HelloWorld world = new HelloWorld(); System.out.println(world.Hello()); } }
import junit.framework.TestCase; public class Test extends TestCase{ public Test(String name){ super(name); } public static void main(String args[]){ junit.textui.TestRunner.run(Test.class); } public void test() { HelloWorld world = new HelloWorld(); assertEquals("Hello Xu Luhan", world.Hello()); } }
以上为TASK1。
package Maven1.Maven01; /** * Hello world! * */ public class App { public String sayHello(){ return "Hello Xu Luhan"; } public static void main( String[] args ) { App world = new App(); System.out.println(world.sayHello()); } }
package Maven1.Maven01; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } public void testSayHello(){ App app = new App(); String result = app.sayHello(); assertEquals("Hello Xu Luhan",result); } }
以上为TASK2。
标签:
原文地址:http://www.cnblogs.com/Twink1900/p/4461531.html