|
package Com.TestSample;
import org.junit.After;
import org.junit.Before;
import junit.framework.TestCase;
import Com.HelloWorld.*;
public class TestSample extends TestCase {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
public void testSayWorld()
{
HelloWorld obj=new HelloWorld();
assertEquals("HelloWorld", obj.sayWorld());
}
public void testSayChina()
{
HelloWorld obj=new HelloWorld();
assertEquals("China",obj.sayChina());
}
public void testAssertTrur()
{
HelloWorld obj=new HelloWorld();
assertNotSame("ok", "asdasdasd", obj.sayChina());
}
public static void main()
{
junit.textui.TestRunner.run(TestSample.class);
}
}
###################################################################################################
package Com.HelloWorld;
public class HelloWorld {
public String sayWorld()
{
return ("HelloWorld");
}
public String sayChina()
{
return ("China");
}
} |
|