1 8 package test; 9 10 import junit.framework.TestCase; 11 12 import java.io.Serializable ; 13 import java.lang.reflect.Field ; 14 15 import org.codehaus.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor; 16 17 22 public class SerialVerUidTest extends TestCase implements Serializable { 23 static { 24 System.gc(); 25 } 26 27 public Object [] someMethod() { 28 return null; 29 } 30 31 protected static final int someField = 32; 32 33 public void testSerialVerUid() throws Throwable { 34 long UID = SerialVersionUidVisitor.calculateSerialVersionUID(SerialVerUidTest.class); 35 37 Field f = SerialVerUidTest.class.getDeclaredField("serialVersionUID"); 38 long uid = ((Long )f.get(null)).longValue(); 39 41 try { 43 Class.forName("java.lang.annotation.Annotation"); 44 assertEquals(7614081430767231713L, UID); } catch (ClassNotFoundException e) { 46 assertEquals(-6289975506796941698L, UID); } 48 } 49 50 public static void main(String [] args) { 51 junit.textui.TestRunner.run(suite()); 52 } 53 54 public static junit.framework.Test suite() { 55 return new junit.framework.TestSuite(SerialVerUidTest.class); 56 } 57 } 58 | Popular Tags |