1 package test.renaming; 2 3 import junit.framework.*; 4 5 import test.TestdataHandler; 6 7 13 public class FieldRenamingTest extends RenamingTestBase { 14 public FieldRenamingTest(String name) { 15 super(name); 16 } 17 18 private void checkFieldNameEquals(String oldClassName, String oldFieldName) { 19 String newFieldName = getNewFieldNameByOld(oldClassName, oldFieldName); 20 checkNameEquals(oldFieldName, newFieldName); 21 } 22 23 private void checkFieldNameNotEquals(String oldClassName, String oldFieldName) { 24 String newFieldName = getNewFieldNameByOld(oldClassName, oldFieldName); 25 checkNameNotEquals(oldFieldName, newFieldName); 26 } 27 28 public void testPublicField1() { 30 String oldClassName = "testdata.PubBs1"; 31 String oldFieldName = "pubField4"; 32 checkFieldNameEquals(oldClassName, oldFieldName); 33 } 34 35 public void testPublicField2() { 36 String oldClassName = "testdata.Pub1ExtPubBs1"; 37 String oldFieldName = "pubField4"; 38 checkFieldNameEquals(oldClassName, oldFieldName); 39 } 40 41 public void testPublicField3() { 42 String oldClassName = "testdata.Pac1ExtPubBs1"; 43 String oldFieldName = "pubField4"; 44 checkFieldNameEquals(oldClassName, oldFieldName); 45 } 46 47 public void testPublicField4() { 48 String oldClassName = "testdata.Pac2ExtPac1"; 49 String oldFieldName = "pubField4"; 50 checkFieldNameEquals(oldClassName, oldFieldName); 51 } 52 53 public void testProtectedField1() { 55 String oldClassName = "testdata.PubBs1"; 56 String oldFieldName = "proField3"; 57 checkFieldNameEquals(oldClassName, oldFieldName); 58 } 59 60 public void testProtectedField2() { 61 String oldClassName = "testdata.Pub1ExtPubBs1"; 62 String oldFieldName = "proField3"; 63 checkFieldNameEquals(oldClassName, oldFieldName); 64 } 65 66 public void testProtectedField3() { 67 String oldClassName = "testdata.Pac1ExtPubBs1"; 68 String oldFieldName = "proField3"; 69 checkFieldNameEquals(oldClassName, oldFieldName); 70 } 71 72 public void testProtectedField4() { 73 String oldClassName = "testdata.Pac2ExtPac1"; 74 String oldFieldName = "proField3"; 75 checkFieldNameEquals(oldClassName, oldFieldName); 76 } 77 78 public void testPackageField1() { 80 String oldClassName = "testdata.PubBs1"; 81 String oldFieldName = "pacField2"; 82 checkFieldNameNotEquals(oldClassName, oldFieldName); 83 } 84 85 public void testPackageField2() { 86 String oldClassName = "testdata.Pub1ExtPubBs1"; 87 String oldFieldName = "pacField2"; 88 checkFieldNameNotEquals(oldClassName, oldFieldName); 89 } 90 91 public void testPackageField3() { 92 String oldClassName = "testdata.Pac1ExtPubBs1"; 93 String oldFieldName = "pacField2"; 94 checkFieldNameNotEquals(oldClassName, oldFieldName); 95 } 96 97 public void testPackageField4() { 98 String oldClassName = "testdata.Pac2ExtPac1"; 99 String oldFieldName = "pacField2"; 100 checkFieldNameNotEquals(oldClassName, oldFieldName); 101 } 102 103 public void testPrivateField1() { 105 String oldClassName = "testdata.PubBs1"; 106 String oldFieldName = "priField1"; 107 checkFieldNameNotEquals(oldClassName, oldFieldName); 108 } 109 110 public void testPrivateField2() { 111 String oldClassName = "testdata.Pub1ExtPubBs1"; 112 String oldFieldName = "priField1"; 113 checkFieldNameNotEquals(oldClassName, oldFieldName); 114 } 115 116 public void testPrivateField3() { 117 String oldClassName = "testdata.Pac1ExtPubBs1"; 118 String oldFieldName = "priField1"; 119 checkFieldNameNotEquals(oldClassName, oldFieldName); 120 } 121 122 public void testPrivateField4() { 123 String oldClassName = "testdata.Pac2ExtPac1"; 124 String oldFieldName = "priField1"; 125 checkFieldNameNotEquals(oldClassName, oldFieldName); 126 } 127 } 128 | Popular Tags |