1 package test.renaming; 2 3 import junit.framework.*; 4 5 import test.TestdataHandler; 6 7 13 public class MethodOverrideTest extends RenamingTestBase { 14 public MethodOverrideTest(String name) { 15 super(name); 16 } 17 18 private void checkMethodNameSigEquals(String oldClassName1, String oldClassName2, String oldMethodName, String oldMethodSig) { 19 String newMethodName1 = getNewMethodNameByOld(oldClassName1, oldMethodName, oldMethodSig); 20 String newMethodSig1 = getNewMethodSigByOld(oldClassName1, oldMethodName, oldMethodSig); 21 String newMethodName2 = getNewMethodNameByOld(oldClassName2, oldMethodName, oldMethodSig); 22 String newMethodSig2 = getNewMethodSigByOld(oldClassName2, oldMethodName, oldMethodSig); 23 24 checkNameEquals(newMethodName1, newMethodName2); 25 checkNameEquals(newMethodSig1, newMethodSig2); 26 } 27 28 public void testPublicMethod40() { 30 String oldMethodName = "pubMethod40"; 31 String oldMethodSig = "()V"; 32 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 33 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 34 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 35 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 36 } 37 38 public void testPublicMethod41() { 39 String oldMethodName = "pubMethod41"; 40 String oldMethodSig = "(Ltestdata/PubBs1;)V"; 41 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 42 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 43 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 44 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 45 } 46 47 public void testPublicMethod42() { 48 String oldMethodName = "pubMethod42"; 49 String oldMethodSig = "(Ltestdata/Pac1ExtPubBs1;)V"; 50 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 51 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 52 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 53 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 54 } 55 56 public void testPublicMethod43() { 57 String oldMethodName = "pubMethod43"; 58 String oldMethodSig = "(Ltestdata/Pub1ExtPubBs1;)V"; 59 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 60 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 61 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 62 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 63 } 64 65 public void testProtectedMethod30() { 67 String oldMethodName = "proMethod30"; 68 String oldMethodSig = "()V"; 69 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 70 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 71 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 72 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 73 } 74 75 public void testProtectedMethod31() { 76 String oldMethodName = "proMethod31"; 77 String oldMethodSig = "(Ltestdata/PubBs1;)V"; 78 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 79 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 80 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 81 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 82 } 83 84 public void testProtectedMethod32() { 85 String oldMethodName = "proMethod32"; 86 String oldMethodSig = "(Ltestdata/Pac1ExtPubBs1;)V"; 87 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 88 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 89 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 90 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 91 } 92 93 public void testProtectedMethod33() { 94 String oldMethodName = "proMethod33"; 95 String oldMethodSig = "(Ltestdata/Pub1ExtPubBs1;)V"; 96 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 97 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 98 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 99 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 100 } 101 102 public void testPackageMethod20() { 104 String oldMethodName = "pacMethod20"; 105 String oldMethodSig = "()V"; 106 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 107 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 108 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 109 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 110 } 111 112 public void testPackageMethod21() { 113 String oldMethodName = "pacMethod21"; 114 String oldMethodSig = "(Ltestdata/PubBs1;)V"; 115 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 116 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 117 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 118 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 119 } 120 121 public void testPackageMethod22() { 122 String oldMethodName = "pacMethod22"; 123 String oldMethodSig = "(Ltestdata/Pac1ExtPubBs1;)V"; 124 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 125 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 126 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 127 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 128 } 129 130 public void testPackageMethod23() { 131 String oldMethodName = "pacMethod23"; 132 String oldMethodSig = "(Ltestdata/Pub1ExtPubBs1;)V"; 133 checkMethodNameSigEquals("testdata.Pub1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 134 checkMethodNameSigEquals("testdata.Pac1ExtPubBs1", "testdata.PubBs1", oldMethodName, oldMethodSig); 135 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.Pac1ExtPubBs1", oldMethodName, oldMethodSig); 136 checkMethodNameSigEquals("testdata.Pac2ExtPac1", "testdata.PubBs1", oldMethodName, oldMethodSig); 137 } 138 } 139 | Popular Tags |