KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > renaming > MethodOverrideTest


1 package test.renaming;
2
3 import junit.framework.*;
4
5 import test.TestdataHandler;
6
7 /**
8  * Method Override Test
9  *
10  * @version $Id: MethodOverrideTest.java,v 1.1 2002/04/17 05:08:24 hchacha Exp $
11  * @author Hidetoshi Ohuchi <hchacha@users.sourceforge.net>
12  */

13 public class MethodOverrideTest extends RenamingTestBase {
14    public MethodOverrideTest(String JavaDoc name) {
15       super(name);
16    }
17
18    private void checkMethodNameSigEquals(String JavaDoc oldClassName1, String JavaDoc oldClassName2, String JavaDoc oldMethodName, String JavaDoc oldMethodSig) {
19       String JavaDoc newMethodName1 = getNewMethodNameByOld(oldClassName1, oldMethodName, oldMethodSig);
20       String JavaDoc newMethodSig1 = getNewMethodSigByOld(oldClassName1, oldMethodName, oldMethodSig);
21       String JavaDoc newMethodName2 = getNewMethodNameByOld(oldClassName2, oldMethodName, oldMethodSig);
22       String JavaDoc newMethodSig2 = getNewMethodSigByOld(oldClassName2, oldMethodName, oldMethodSig);
23
24       checkNameEquals(newMethodName1, newMethodName2);
25       checkNameEquals(newMethodSig1, newMethodSig2);
26    }
27
28    //------------------------------------------------------------------
29
public void testPublicMethod40() {
30       String JavaDoc oldMethodName = "pubMethod40";
31       String JavaDoc 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 JavaDoc oldMethodName = "pubMethod41";
40       String JavaDoc 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 JavaDoc oldMethodName = "pubMethod42";
49       String JavaDoc 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 JavaDoc oldMethodName = "pubMethod43";
58       String JavaDoc 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    //------------------------------------------------------------------
66
public void testProtectedMethod30() {
67       String JavaDoc oldMethodName = "proMethod30";
68       String JavaDoc 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 JavaDoc oldMethodName = "proMethod31";
77       String JavaDoc 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 JavaDoc oldMethodName = "proMethod32";
86       String JavaDoc 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 JavaDoc oldMethodName = "proMethod33";
95       String JavaDoc 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    //------------------------------------------------------------------
103
public void testPackageMethod20() {
104       String JavaDoc oldMethodName = "pacMethod20";
105       String JavaDoc 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 JavaDoc oldMethodName = "pacMethod21";
114       String JavaDoc 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 JavaDoc oldMethodName = "pacMethod22";
123       String JavaDoc 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 JavaDoc oldMethodName = "pacMethod23";
132       String JavaDoc 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