|
Lines 1-450
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2003 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2003 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Common Public License v1.0 |
4 |
* are made available under the terms of the Common Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/cpl-v10.html |
6 |
* http://www.eclipse.org/legal/cpl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.jdt.ui.tests.refactoring; |
11 |
package org.eclipse.jdt.ui.tests.refactoring; |
| 12 |
|
12 |
|
| 13 |
import junit.framework.Test; |
13 |
import junit.framework.Test; |
| 14 |
import junit.framework.TestSuite; |
14 |
import junit.framework.TestSuite; |
| 15 |
|
15 |
|
| 16 |
import org.eclipse.jdt.core.ICompilationUnit; |
16 |
import org.eclipse.jdt.core.ICompilationUnit; |
| 17 |
import org.eclipse.jdt.core.IField; |
17 |
import org.eclipse.jdt.core.IField; |
| 18 |
import org.eclipse.jdt.core.IMember; |
18 |
import org.eclipse.jdt.core.IMember; |
| 19 |
import org.eclipse.jdt.core.IMethod; |
19 |
import org.eclipse.jdt.core.IMethod; |
| 20 |
import org.eclipse.jdt.core.IPackageFragment; |
20 |
import org.eclipse.jdt.core.IPackageFragment; |
| 21 |
import org.eclipse.jdt.core.IType; |
21 |
import org.eclipse.jdt.core.IType; |
| 22 |
import org.eclipse.jdt.core.JavaModelException; |
22 |
import org.eclipse.jdt.core.JavaModelException; |
| 23 |
|
23 |
|
| 24 |
import org.eclipse.jdt.ui.tests.refactoring.infra.DebugUtils; |
24 |
import org.eclipse.jdt.ui.tests.refactoring.infra.DebugUtils; |
| 25 |
|
25 |
|
| 26 |
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; |
26 |
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; |
| 27 |
|
27 |
|
| 28 |
import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatus; |
28 |
import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatus; |
| 29 |
import org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersRefactoring; |
29 |
import org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersRefactoring; |
| 30 |
|
30 |
|
| 31 |
public class MoveMembersTests extends RefactoringTest { |
31 |
public class MoveMembersTests extends RefactoringTest { |
| 32 |
|
32 |
|
| 33 |
private static final Class clazz= MoveMembersTests.class; |
33 |
private static final Class clazz= MoveMembersTests.class; |
| 34 |
|
34 |
|
| 35 |
private static final String REFACTORING_PATH= "MoveMembers/"; |
35 |
private static final String REFACTORING_PATH= "MoveMembers/"; |
| 36 |
|
36 |
|
| 37 |
public MoveMembersTests(String name) { |
37 |
public MoveMembersTests(String name) { |
| 38 |
super(name); |
38 |
super(name); |
| 39 |
} |
39 |
} |
| 40 |
|
40 |
|
| 41 |
public static Test suite() { |
41 |
public static Test suite() { |
| 42 |
return new MySetup(new TestSuite(clazz)); |
42 |
return new MySetup(new TestSuite(clazz)); |
| 43 |
} |
43 |
} |
| 44 |
|
44 |
|
| 45 |
protected String getRefactoringPath() { |
45 |
protected String getRefactoringPath() { |
| 46 |
return REFACTORING_PATH; |
46 |
return REFACTORING_PATH; |
| 47 |
} |
47 |
} |
| 48 |
|
48 |
|
| 49 |
//--- |
49 |
//--- |
| 50 |
private static MoveStaticMembersRefactoring createRefactoring(IMember[] members) throws JavaModelException{ |
50 |
private static MoveStaticMembersRefactoring createRefactoring(IMember[] members) throws JavaModelException{ |
| 51 |
return MoveStaticMembersRefactoring.create(members, JavaPreferencesSettings.getCodeGenerationSettings()); |
51 |
return MoveStaticMembersRefactoring.create(members, JavaPreferencesSettings.getCodeGenerationSettings()); |
| 52 |
} |
52 |
} |
| 53 |
|
53 |
|
| 54 |
protected void setUp() throws Exception { |
54 |
protected void setUp() throws Exception { |
| 55 |
if (fIsVerbose) |
55 |
if (fIsVerbose) |
| 56 |
DebugUtils.dump("--------- " + getName() + " ---------------"); |
56 |
DebugUtils.dump("--------- " + getName() + " ---------------"); |
| 57 |
super.setUp(); |
57 |
super.setUp(); |
| 58 |
} |
58 |
} |
| 59 |
|
59 |
|
| 60 |
private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures, IPackageFragment packForA, IPackageFragment packForB) throws Exception { |
60 |
private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures, IPackageFragment packForA, IPackageFragment packForB) throws Exception { |
| 61 |
ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); |
61 |
ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); |
| 62 |
ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); |
62 |
ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); |
| 63 |
try{ |
63 |
try{ |
| 64 |
IType typeA= getType(cuA, "A"); |
64 |
IType typeA= getType(cuA, "A"); |
| 65 |
IType typeB= getType(cuB, "B"); |
65 |
IType typeB= getType(cuB, "B"); |
| 66 |
IField[] fields= getFields(typeA, fieldNames); |
66 |
IField[] fields= getFields(typeA, fieldNames); |
| 67 |
IMethod[] methods= getMethods(typeA, methodNames, signatures); |
67 |
IMethod[] methods= getMethods(typeA, methodNames, signatures); |
| 68 |
|
68 |
|
| 69 |
MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); |
69 |
MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); |
| 70 |
IType destinationType= typeB; |
70 |
IType destinationType= typeB; |
| 71 |
ref.setDestinationTypeFullyQualifiedName(destinationType.getFullyQualifiedName()); |
71 |
ref.setDestinationTypeFullyQualifiedName(destinationType.getFullyQualifiedName()); |
| 72 |
|
72 |
|
| 73 |
RefactoringStatus result= performRefactoringWithStatus(ref); |
73 |
RefactoringStatus result= performRefactoringWithStatus(ref); |
| 74 |
assertTrue("precondition was supposed to pass", result.getSeverity() <= RefactoringStatus.WARNING); |
74 |
assertTrue("precondition was supposed to pass", result.getSeverity() <= RefactoringStatus.WARNING); |
| 75 |
|
75 |
|
| 76 |
String expected; |
76 |
String expected; |
| 77 |
String actual; |
77 |
String actual; |
| 78 |
|
78 |
|
| 79 |
expected= getFileContents(getOutputTestFileName("A")); |
79 |
expected= getFileContents(getOutputTestFileName("A")); |
| 80 |
actual= cuA.getSource(); |
80 |
actual= cuA.getSource(); |
| 81 |
assertEquals("incorrect modification of A", expected, actual); |
81 |
assertEquals("incorrect modification of A", expected, actual); |
| 82 |
|
82 |
|
| 83 |
expected= getFileContents(getOutputTestFileName("B")); |
83 |
expected= getFileContents(getOutputTestFileName("B")); |
| 84 |
actual= cuB.getSource(); |
84 |
actual= cuB.getSource(); |
| 85 |
assertEquals("incorrect modification of B", expected, actual); |
85 |
assertEquals("incorrect modification of B", expected, actual); |
| 86 |
|
86 |
|
| 87 |
} finally{ |
87 |
} finally{ |
| 88 |
performDummySearch(); |
88 |
performDummySearch(); |
| 89 |
cuA.delete(false, null); |
89 |
cuA.delete(false, null); |
| 90 |
cuB.delete(false, null); |
90 |
cuB.delete(false, null); |
| 91 |
} |
91 |
} |
| 92 |
} |
92 |
} |
| 93 |
|
93 |
|
| 94 |
private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures) throws Exception{ |
94 |
private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures) throws Exception{ |
| 95 |
IPackageFragment packForA= getPackageP(); |
95 |
IPackageFragment packForA= getPackageP(); |
| 96 |
IPackageFragment packForB= getPackageP(); |
96 |
IPackageFragment packForB= getPackageP(); |
| 97 |
fieldMethodHelper_passingTest(fieldNames, methodNames, signatures, packForA, packForB); |
97 |
fieldMethodHelper_passingTest(fieldNames, methodNames, signatures, packForA, packForB); |
| 98 |
} |
98 |
} |
| 99 |
|
99 |
|
| 100 |
private void fieldMethodHelper_failingTest(String[] fieldNames, |
100 |
private void fieldMethodHelper_failingTest(String[] fieldNames, |
| 101 |
String[] methodNames, String[][] signatures, |
101 |
String[] methodNames, String[][] signatures, |
| 102 |
int errorLevel, String destinationTypeName, |
102 |
int errorLevel, String destinationTypeName, |
| 103 |
IPackageFragment packForA, |
103 |
IPackageFragment packForA, |
| 104 |
IPackageFragment packForB) throws Exception { |
104 |
IPackageFragment packForB) throws Exception { |
| 105 |
ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); |
105 |
ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); |
| 106 |
ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); |
106 |
ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); |
| 107 |
try{ |
107 |
try{ |
| 108 |
IType typeA= getType(cuA, "A"); |
108 |
IType typeA= getType(cuA, "A"); |
| 109 |
IField[] fields= getFields(typeA, fieldNames); |
109 |
IField[] fields= getFields(typeA, fieldNames); |
| 110 |
IMethod[] methods= getMethods(typeA, methodNames, signatures); |
110 |
IMethod[] methods= getMethods(typeA, methodNames, signatures); |
| 111 |
|
111 |
|
| 112 |
MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); |
112 |
MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); |
| 113 |
if (ref == null){ |
113 |
if (ref == null){ |
| 114 |
assertEquals(errorLevel, RefactoringStatus.FATAL); |
114 |
assertEquals(errorLevel, RefactoringStatus.FATAL); |
| 115 |
return; |
115 |
return; |
| 116 |
} |
116 |
} |
| 117 |
ref.setDestinationTypeFullyQualifiedName(destinationTypeName); |
117 |
ref.setDestinationTypeFullyQualifiedName(destinationTypeName); |
| 118 |
|
118 |
|
| 119 |
RefactoringStatus result= performRefactoring(ref); |
119 |
RefactoringStatus result= performRefactoring(ref); |
| 120 |
if (fIsVerbose) |
120 |
if (fIsVerbose) |
| 121 |
DebugUtils.dump("status:" + result); |
121 |
DebugUtils.dump("status:" + result); |
| 122 |
assertNotNull("precondition was supposed to fail", result); |
122 |
assertNotNull("precondition was supposed to fail", result); |
| 123 |
assertEquals("precondition was supposed to fail", errorLevel, result.getSeverity()); |
123 |
assertEquals("precondition was supposed to fail", errorLevel, result.getSeverity()); |
| 124 |
|
124 |
|
| 125 |
} finally{ |
125 |
} finally{ |
| 126 |
performDummySearch(); |
126 |
performDummySearch(); |
| 127 |
cuA.delete(false, null); |
127 |
cuA.delete(false, null); |
| 128 |
cuB.delete(false, null); |
128 |
cuB.delete(false, null); |
| 129 |
} |
129 |
} |
| 130 |
} |
130 |
} |
| 131 |
|
131 |
|
| 132 |
private void fieldMethodHelper_failingTest(String[] fieldNames, |
132 |
private void fieldMethodHelper_failingTest(String[] fieldNames, |
| 133 |
String[] methodNames, String[][] signatures, |
133 |
String[] methodNames, String[][] signatures, |
| 134 |
int errorLevel, String destinationTypeName) throws Exception { |
134 |
int errorLevel, String destinationTypeName) throws Exception { |
| 135 |
IPackageFragment packForA= getPackageP(); |
135 |
IPackageFragment packForA= getPackageP(); |
| 136 |
IPackageFragment packForB= getPackageP(); |
136 |
IPackageFragment packForB= getPackageP(); |
| 137 |
fieldMethodHelper_failingTest(fieldNames, methodNames, signatures, errorLevel, destinationTypeName, packForA, packForB); |
137 |
fieldMethodHelper_failingTest(fieldNames, methodNames, signatures, errorLevel, destinationTypeName, packForA, packForB); |
| 138 |
} |
138 |
} |
| 139 |
//--- |
139 |
//--- |
| 140 |
public void test0() throws Exception{ |
140 |
public void test0() throws Exception{ |
| 141 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
141 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 142 |
} |
142 |
} |
| 143 |
|
143 |
|
| 144 |
public void test1() throws Exception{ |
144 |
public void test1() throws Exception{ |
| 145 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
145 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 146 |
} |
146 |
} |
| 147 |
|
147 |
|
| 148 |
public void test2() throws Exception{ |
148 |
public void test2() throws Exception{ |
| 149 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
149 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 150 |
} |
150 |
} |
| 151 |
|
151 |
|
| 152 |
public void test3() throws Exception{ |
152 |
public void test3() throws Exception{ |
| 153 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
153 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 154 |
} |
154 |
} |
| 155 |
|
155 |
|
| 156 |
public void test4() throws Exception{ |
156 |
public void test4() throws Exception{ |
| 157 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
157 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 158 |
} |
158 |
} |
| 159 |
|
159 |
|
| 160 |
public void test5() throws Exception{ |
160 |
public void test5() throws Exception{ |
| 161 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); |
161 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); |
| 162 |
} |
162 |
} |
| 163 |
|
163 |
|
| 164 |
public void test6() throws Exception{ |
164 |
public void test6() throws Exception{ |
| 165 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); |
165 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); |
| 166 |
} |
166 |
} |
| 167 |
|
167 |
|
| 168 |
public void test7() throws Exception{ |
168 |
public void test7() throws Exception{ |
| 169 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); |
169 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); |
| 170 |
} |
170 |
} |
| 171 |
|
171 |
|
| 172 |
public void test8() throws Exception{ |
172 |
public void test8() throws Exception{ |
| 173 |
// printTestDisabledMessage("36835"); |
173 |
// printTestDisabledMessage("36835"); |
| 174 |
IPackageFragment packageForB= null; |
174 |
IPackageFragment packageForB= null; |
| 175 |
try{ |
175 |
try{ |
| 176 |
packageForB= getRoot().createPackageFragment("r", false, null); |
176 |
packageForB= getRoot().createPackageFragment("r", false, null); |
| 177 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0], getPackageP(), packageForB); |
177 |
fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0], getPackageP(), packageForB); |
| 178 |
} finally{ |
178 |
} finally{ |
| 179 |
performDummySearch(); |
179 |
performDummySearch(); |
| 180 |
if (packageForB != null) |
180 |
if (packageForB != null) |
| 181 |
packageForB.delete(true, null); |
181 |
packageForB.delete(true, null); |
| 182 |
} |
182 |
} |
| 183 |
} |
183 |
} |
| 184 |
|
184 |
|
| 185 |
public void test9() throws Exception{ |
185 |
public void test9() throws Exception{ |
| 186 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
186 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 187 |
} |
187 |
} |
| 188 |
|
188 |
|
| 189 |
public void test10() throws Exception{ |
189 |
public void test10() throws Exception{ |
| 190 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
190 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 191 |
} |
191 |
} |
| 192 |
|
192 |
|
| 193 |
public void test11() throws Exception{ |
193 |
public void test11() throws Exception{ |
| 194 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
194 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 195 |
} |
195 |
} |
| 196 |
|
196 |
|
| 197 |
public void test12() throws Exception{ |
197 |
public void test12() throws Exception{ |
| 198 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
198 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 199 |
} |
199 |
} |
| 200 |
|
200 |
|
| 201 |
public void test13() throws Exception{ |
201 |
public void test13() throws Exception{ |
| 202 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
202 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 203 |
} |
203 |
} |
| 204 |
|
204 |
|
| 205 |
public void test14() throws Exception{ |
205 |
public void test14() throws Exception{ |
| 206 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
206 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 207 |
} |
207 |
} |
| 208 |
|
208 |
|
| 209 |
public void test15() throws Exception{ |
209 |
public void test15() throws Exception{ |
| 210 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
210 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 211 |
} |
211 |
} |
| 212 |
|
212 |
|
| 213 |
public void test16() throws Exception{ |
213 |
public void test16() throws Exception{ |
| 214 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
214 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 215 |
} |
215 |
} |
| 216 |
|
216 |
|
| 217 |
public void test17() throws Exception{ |
217 |
public void test17() throws Exception{ |
| 218 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
218 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 219 |
} |
219 |
} |
| 220 |
|
220 |
|
| 221 |
public void test18() throws Exception{ |
221 |
public void test18() throws Exception{ |
| 222 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
222 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 223 |
} |
223 |
} |
| 224 |
|
224 |
|
| 225 |
public void test19() throws Exception{ |
225 |
public void test19() throws Exception{ |
| 226 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
226 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 227 |
} |
227 |
} |
| 228 |
|
228 |
|
| 229 |
public void test20() throws Exception{ |
229 |
public void test20() throws Exception{ |
| 230 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
230 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 231 |
} |
231 |
} |
| 232 |
|
232 |
|
| 233 |
public void test21() throws Exception{ |
233 |
public void test21() throws Exception{ |
| 234 |
printTestDisabledMessage("incorrect warning"); |
234 |
printTestDisabledMessage("incorrect warning"); |
| 235 |
// fieldMethodHelper_passingTest(new String[]{"F", "i"}, new String[0], new String[0][0]); |
235 |
// fieldMethodHelper_passingTest(new String[]{"F", "i"}, new String[0], new String[0][0]); |
| 236 |
} |
236 |
} |
| 237 |
|
237 |
|
| 238 |
public void test22() throws Exception{ |
238 |
public void test22() throws Exception{ |
| 239 |
printTestDisabledMessage("nasty corner case"); |
239 |
printTestDisabledMessage("nasty corner case"); |
| 240 |
// fieldMethodHelper_passingTest(new String[]{"i"}, new String[0], new String[0][0]); |
240 |
// fieldMethodHelper_passingTest(new String[]{"i"}, new String[0], new String[0][0]); |
| 241 |
} |
241 |
} |
| 242 |
|
242 |
|
| 243 |
public void test23() throws Exception{ |
243 |
public void test23() throws Exception{ |
| 244 |
fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); |
244 |
fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); |
| 245 |
} |
245 |
} |
| 246 |
|
246 |
|
| 247 |
public void test24() throws Exception{ |
247 |
public void test24() throws Exception{ |
| 248 |
fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); |
248 |
fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); |
| 249 |
} |
249 |
} |
| 250 |
|
250 |
|
| 251 |
public void test25() throws Exception{ |
251 |
public void test25() throws Exception{ |
| 252 |
//printTestDisabledMessage("test for 27098"); |
252 |
//printTestDisabledMessage("test for 27098"); |
| 253 |
fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); |
253 |
fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); |
| 254 |
} |
254 |
} |
| 255 |
|
255 |
|
| 256 |
public void test26() throws Exception{ |
256 |
public void test26() throws Exception{ |
| 257 |
IPackageFragment packageForB= null; |
257 |
IPackageFragment packageForB= null; |
| 258 |
try{ |
258 |
try{ |
| 259 |
packageForB= getRoot().createPackageFragment("r", false, null); |
259 |
packageForB= getRoot().createPackageFragment("r", false, null); |
| 260 |
fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); |
260 |
fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); |
| 261 |
} finally{ |
261 |
} finally{ |
| 262 |
performDummySearch(); |
262 |
performDummySearch(); |
| 263 |
if (packageForB != null) |
263 |
if (packageForB != null) |
| 264 |
packageForB.delete(true, null); |
264 |
packageForB.delete(true, null); |
| 265 |
} |
265 |
} |
| 266 |
} |
266 |
} |
| 267 |
|
267 |
|
| 268 |
public void test27() throws Exception{ |
268 |
public void test27() throws Exception{ |
| 269 |
IPackageFragment packageForB= null; |
269 |
IPackageFragment packageForB= null; |
| 270 |
try{ |
270 |
try{ |
| 271 |
packageForB= getRoot().createPackageFragment("r", false, null); |
271 |
packageForB= getRoot().createPackageFragment("r", false, null); |
| 272 |
fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); |
272 |
fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); |
| 273 |
} finally{ |
273 |
} finally{ |
| 274 |
performDummySearch(); |
274 |
performDummySearch(); |
| 275 |
if (packageForB != null) |
275 |
if (packageForB != null) |
| 276 |
packageForB.delete(true, null); |
276 |
packageForB.delete(true, null); |
| 277 |
} |
277 |
} |
| 278 |
} |
278 |
} |
| 279 |
|
279 |
|
| 280 |
public void test28() throws Exception{ |
280 |
public void test28() throws Exception{ |
| 281 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m", "n"}, new String[][]{new String[0], new String[0]}); |
281 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m", "n"}, new String[][]{new String[0], new String[0]}); |
| 282 |
} |
282 |
} |
| 283 |
|
283 |
|
| 284 |
public void test29() throws Exception{ //test for bug 41691 |
284 |
public void test29() throws Exception{ //test for bug 41691 |
| 285 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
285 |
fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 286 |
} |
286 |
} |
| 287 |
|
287 |
|
| 288 |
public void test30() throws Exception{ //test for bug 41691 |
288 |
public void test30() throws Exception{ //test for bug 41691 |
| 289 |
fieldMethodHelper_passingTest(new String[]{"id"}, new String[0], new String[0][0]); |
289 |
fieldMethodHelper_passingTest(new String[]{"id"}, new String[0], new String[0][0]); |
| 290 |
} |
290 |
} |
| 291 |
|
291 |
|
| 292 |
public void test31() throws Exception{ //test for bug 41691 |
292 |
public void test31() throws Exception{ //test for bug 41691 |
| 293 |
fieldMethodHelper_passingTest(new String[]{"odd"}, new String[0], new String[0][0]); |
293 |
fieldMethodHelper_passingTest(new String[]{"odd"}, new String[0], new String[0][0]); |
| 294 |
} |
294 |
} |
| 295 |
|
295 |
|
| 296 |
//--- |
296 |
public void test32() throws Exception{ //test for bug 41734, 41691 |
| 297 |
public void testFail0() throws Exception{ |
297 |
printTestDisabledMessage("test for 41734"); |
| 298 |
fieldMethodHelper_failingTest(new String[0], |
298 |
//fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); |
| 299 |
new String[]{"m"}, new String[][]{new String[0]}, |
299 |
} |
| 300 |
RefactoringStatus.FATAL, "p.B"); |
300 |
|
| 301 |
} |
301 |
//--- |
| 302 |
|
302 |
public void testFail0() throws Exception{ |
| 303 |
|
303 |
fieldMethodHelper_failingTest(new String[0], |
| 304 |
public void testFail1() throws Exception{ |
304 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 305 |
fieldMethodHelper_failingTest(new String[0], |
305 |
RefactoringStatus.FATAL, "p.B"); |
| 306 |
new String[]{"m"}, new String[][]{new String[0]}, |
306 |
} |
| 307 |
RefactoringStatus.ERROR, "p.B.X"); |
307 |
|
| 308 |
} |
308 |
|
| 309 |
|
309 |
public void testFail1() throws Exception{ |
| 310 |
public void testFail2() throws Exception{ |
310 |
fieldMethodHelper_failingTest(new String[0], |
| 311 |
fieldMethodHelper_failingTest(new String[0], |
311 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 312 |
new String[]{"m"}, new String[][]{new String[0]}, |
312 |
RefactoringStatus.ERROR, "p.B.X"); |
| 313 |
RefactoringStatus.ERROR, "p.B"); |
313 |
} |
| 314 |
} |
314 |
|
| 315 |
|
315 |
public void testFail2() throws Exception{ |
| 316 |
public void testFail3() throws Exception{ |
316 |
fieldMethodHelper_failingTest(new String[0], |
| 317 |
fieldMethodHelper_failingTest(new String[0], |
317 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 318 |
new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, |
318 |
RefactoringStatus.ERROR, "p.B"); |
| 319 |
RefactoringStatus.ERROR, "p.B"); |
319 |
} |
| 320 |
} |
320 |
|
| 321 |
|
321 |
public void testFail3() throws Exception{ |
| 322 |
public void testFail4() throws Exception{ |
322 |
fieldMethodHelper_failingTest(new String[0], |
| 323 |
fieldMethodHelper_failingTest(new String[0], |
323 |
new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, |
| 324 |
new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, |
324 |
RefactoringStatus.ERROR, "p.B"); |
| 325 |
RefactoringStatus.WARNING, "p.B"); |
325 |
} |
| 326 |
} |
326 |
|
| 327 |
|
327 |
public void testFail4() throws Exception{ |
| 328 |
public void testFail5() throws Exception{ |
328 |
fieldMethodHelper_failingTest(new String[0], |
| 329 |
fieldMethodHelper_failingTest(new String[0], |
329 |
new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, |
| 330 |
new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, |
330 |
RefactoringStatus.WARNING, "p.B"); |
| 331 |
RefactoringStatus.WARNING, "p.B"); |
331 |
} |
| 332 |
} |
332 |
|
| 333 |
|
333 |
public void testFail5() throws Exception{ |
| 334 |
public void testFail6() throws Exception{ |
334 |
fieldMethodHelper_failingTest(new String[0], |
| 335 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
335 |
new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, |
| 336 |
RefactoringStatus.ERROR, "p.B"); |
336 |
RefactoringStatus.WARNING, "p.B"); |
| 337 |
} |
337 |
} |
| 338 |
|
338 |
|
| 339 |
public void testFail7() throws Exception{ |
339 |
public void testFail6() throws Exception{ |
| 340 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
340 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
| 341 |
RefactoringStatus.ERROR, "p.B"); |
341 |
RefactoringStatus.ERROR, "p.B"); |
| 342 |
} |
342 |
} |
| 343 |
|
343 |
|
| 344 |
public void testFail8() throws Exception{ |
344 |
public void testFail7() throws Exception{ |
| 345 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
345 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
| 346 |
RefactoringStatus.ERROR, "p.B"); |
346 |
RefactoringStatus.ERROR, "p.B"); |
| 347 |
} |
347 |
} |
| 348 |
|
348 |
|
| 349 |
public void testFail9() throws Exception{ |
349 |
public void testFail8() throws Exception{ |
| 350 |
fieldMethodHelper_failingTest(new String[0], |
350 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
| 351 |
new String[]{"m"}, new String[][]{new String[0]}, |
351 |
RefactoringStatus.ERROR, "p.B"); |
| 352 |
RefactoringStatus.WARNING, "p.B"); |
352 |
} |
| 353 |
} |
353 |
|
| 354 |
|
354 |
public void testFail9() throws Exception{ |
| 355 |
public void testFail10() throws Exception{ |
355 |
fieldMethodHelper_failingTest(new String[0], |
| 356 |
fieldMethodHelper_failingTest(new String[0], |
356 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 357 |
new String[]{"m"}, new String[][]{new String[0]}, |
357 |
RefactoringStatus.WARNING, "p.B"); |
| 358 |
RefactoringStatus.WARNING, "p.B"); |
358 |
} |
| 359 |
} |
359 |
|
| 360 |
|
360 |
public void testFail10() throws Exception{ |
| 361 |
public void testFail11() throws Exception{ |
361 |
fieldMethodHelper_failingTest(new String[0], |
| 362 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
362 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 363 |
RefactoringStatus.WARNING, "p.B"); |
363 |
RefactoringStatus.WARNING, "p.B"); |
| 364 |
} |
364 |
} |
| 365 |
|
365 |
|
| 366 |
public void testFail12() throws Exception{ |
366 |
public void testFail11() throws Exception{ |
| 367 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
367 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
| 368 |
RefactoringStatus.WARNING, "p.B"); |
368 |
RefactoringStatus.WARNING, "p.B"); |
| 369 |
} |
369 |
} |
| 370 |
|
370 |
|
| 371 |
public void testFail13() throws Exception{ |
371 |
public void testFail12() throws Exception{ |
| 372 |
fieldMethodHelper_failingTest(new String[0], |
372 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
| 373 |
new String[]{"m"}, new String[][]{new String[0]}, |
373 |
RefactoringStatus.WARNING, "p.B"); |
| 374 |
RefactoringStatus.WARNING, "p.B"); |
374 |
} |
| 375 |
} |
375 |
|
| 376 |
|
376 |
public void testFail13() throws Exception{ |
| 377 |
public void testFail14() throws Exception{ |
377 |
fieldMethodHelper_failingTest(new String[0], |
| 378 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
378 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 379 |
RefactoringStatus.WARNING, "p.B"); |
379 |
RefactoringStatus.WARNING, "p.B"); |
| 380 |
} |
380 |
} |
| 381 |
|
381 |
|
| 382 |
public void testFail15() throws Exception{ |
382 |
public void testFail14() throws Exception{ |
| 383 |
fieldMethodHelper_failingTest(new String[0], |
383 |
fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], |
| 384 |
new String[]{"m"}, new String[][]{new String[0]}, |
384 |
RefactoringStatus.WARNING, "p.B"); |
| 385 |
RefactoringStatus.WARNING, "p.B"); |
385 |
} |
| 386 |
} |
386 |
|
| 387 |
|
387 |
public void testFail15() throws Exception{ |
| 388 |
public void testFail16() throws Exception{ |
388 |
fieldMethodHelper_failingTest(new String[0], |
| 389 |
IPackageFragment packageForB= null; |
389 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 390 |
try{ |
390 |
RefactoringStatus.WARNING, "p.B"); |
| 391 |
packageForB= getRoot().createPackageFragment("r", false, null); |
391 |
} |
| 392 |
fieldMethodHelper_failingTest(new String[]{"f"}, new String[0], new String[0][0], |
392 |
|
| 393 |
RefactoringStatus.WARNING, "r.B", |
393 |
public void testFail16() throws Exception{ |
| 394 |
getPackageP(), packageForB); |
394 |
IPackageFragment packageForB= null; |
| 395 |
} finally{ |
395 |
try{ |
| 396 |
performDummySearch(); |
396 |
packageForB= getRoot().createPackageFragment("r", false, null); |
| 397 |
if (packageForB != null) |
397 |
fieldMethodHelper_failingTest(new String[]{"f"}, new String[0], new String[0][0], |
| 398 |
packageForB.delete(true, null); |
398 |
RefactoringStatus.WARNING, "r.B", |
| 399 |
} |
399 |
getPackageP(), packageForB); |
| 400 |
} |
400 |
} finally{ |
| 401 |
|
401 |
performDummySearch(); |
| 402 |
public void testFail17() throws Exception{ |
402 |
if (packageForB != null) |
| 403 |
fieldMethodHelper_failingTest(new String[0], |
403 |
packageForB.delete(true, null); |
| 404 |
new String[]{"m"}, new String[][]{new String[0]}, |
404 |
} |
| 405 |
RefactoringStatus.FATAL, "java.lang.Object"); |
405 |
} |
| 406 |
} |
406 |
|
| 407 |
|
407 |
public void testFail17() throws Exception{ |
| 408 |
public void testFail18() throws Exception{ |
408 |
fieldMethodHelper_failingTest(new String[0], |
| 409 |
fieldMethodHelper_failingTest(new String[0], |
409 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 410 |
new String[]{"m"}, new String[][]{new String[0]}, |
410 |
RefactoringStatus.FATAL, "java.lang.Object"); |
| 411 |
RefactoringStatus.FATAL, "p.DontExist"); |
411 |
} |
| 412 |
} |
412 |
|
| 413 |
|
413 |
public void testFail18() throws Exception{ |
| 414 |
public void testFail19() throws Exception{ |
414 |
fieldMethodHelper_failingTest(new String[0], |
| 415 |
fieldMethodHelper_failingTest(new String[0], |
415 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 416 |
new String[]{"m"}, new String[][]{new String[0]}, |
416 |
RefactoringStatus.FATAL, "p.DontExist"); |
| 417 |
RefactoringStatus.FATAL, "p.B"); |
417 |
} |
| 418 |
} |
418 |
|
| 419 |
|
419 |
public void testFail19() throws Exception{ |
| 420 |
public void testFail20() throws Exception{ |
420 |
fieldMethodHelper_failingTest(new String[0], |
| 421 |
fieldMethodHelper_failingTest(new String[0], |
421 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 422 |
new String[]{"m"}, new String[][]{new String[0]}, |
422 |
RefactoringStatus.FATAL, "p.B"); |
| 423 |
RefactoringStatus.FATAL, "p.B"); |
423 |
} |
| 424 |
} |
424 |
|
| 425 |
|
425 |
public void testFail20() throws Exception{ |
| 426 |
public void testFail21() throws Exception{ |
426 |
fieldMethodHelper_failingTest(new String[0], |
| 427 |
fieldMethodHelper_failingTest(new String[0], |
427 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 428 |
new String[]{"m"}, new String[][]{new String[0]}, |
428 |
RefactoringStatus.FATAL, "p.B"); |
| 429 |
RefactoringStatus.FATAL, "p.B"); |
429 |
} |
| 430 |
} |
430 |
|
| 431 |
|
431 |
public void testFail21() throws Exception{ |
| 432 |
public void testFail22() throws Exception{ |
432 |
fieldMethodHelper_failingTest(new String[0], |
| 433 |
fieldMethodHelper_failingTest(new String[]{"i"}, |
433 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 434 |
new String[0], new String[0][0], |
434 |
RefactoringStatus.FATAL, "p.B"); |
| 435 |
RefactoringStatus.FATAL, "p.B"); |
435 |
} |
| 436 |
} |
436 |
|
| 437 |
|
437 |
public void testFail22() throws Exception{ |
| 438 |
public void testFail23() throws Exception{ |
438 |
fieldMethodHelper_failingTest(new String[]{"i"}, |
| 439 |
fieldMethodHelper_failingTest(new String[]{"i"}, |
439 |
new String[0], new String[0][0], |
| 440 |
new String[0], new String[0][0], |
440 |
RefactoringStatus.FATAL, "p.B"); |
| 441 |
RefactoringStatus.FATAL, "p.B"); |
441 |
} |
| 442 |
} |
442 |
|
| 443 |
|
443 |
public void testFail23() throws Exception{ |
| 444 |
public void testFail24() throws Exception{ |
444 |
fieldMethodHelper_failingTest(new String[]{"i"}, |
| 445 |
fieldMethodHelper_failingTest(new String[0], |
445 |
new String[0], new String[0][0], |
| 446 |
new String[]{"m"}, new String[][]{new String[0]}, |
446 |
RefactoringStatus.FATAL, "p.B"); |
| 447 |
RefactoringStatus.FATAL, "p.B"); |
447 |
} |
| 448 |
} |
448 |
|
| 449 |
|
449 |
public void testFail24() throws Exception{ |
| 450 |
} |
450 |
fieldMethodHelper_failingTest(new String[0], |
|
|
451 |
new String[]{"m"}, new String[][]{new String[0]}, |
| 452 |
RefactoringStatus.FATAL, "p.B"); |
| 453 |
} |
| 454 |
|
| 455 |
} |