package net.runpc.thegreat; public class App1 { public static void main(String[] args) { App1 ap = new App1(); System.out.println("length:" + ap.functionA("string")); } public int functionA(String a){ return a.length() ; } public void functionB(){ System.out.println("do nothing") ; } public String functionC(){ return "test" ; } } ----------------- package net.runpc.thegreat; import junit.framework.TestCase; public class App1Test extends TestCase { App1 AP ; public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite(){ TestSuite suite= new TestSuite(); suite.addTest(new App1Test("App1Test") ); return suite; } protected void setUp() throws Exception { super.setUp(); AP = new App1(); } public void testFunctionA() { assertTrue(AP.functionA("string") > 0 ) ; } public void testFunctionB(){ AP.functionB() ; } public void testFunctionC(){ assertEquals(AP.functionC(),"test" ); } }