1 package test.junit; 2 3 import org.testng.Assert; 4 5 import java.io.Serializable; 6 7 import junit.framework.TestCase; 8 9 public class SetNameTest extends TestCase implements Serializable { 10 public static int m_ctorCount = 0; 11 SetNameTest()12 public SetNameTest() { 13 ppp("CTOR"); 14 m_ctorCount++; 15 } 16 17 @Override setName(String name)18 public void setName(String name) { 19 ppp("SETNAME " + name); 20 super.setName(name); 21 } 22 testFoo()23 public void testFoo() { 24 Assert.assertEquals("testFoo", getName()); 25 ppp("FOO"); 26 } 27 testBar()28 public void testBar() { 29 Assert.assertEquals("testBar", getName()); 30 ppp("BAR"); 31 } 32 ppp(String string)33 private void ppp(String string) { 34 if (false) { 35 System.out.println("[FooBarTest#" + hashCode() + "] " + string); 36 } 37 } 38 }