KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > hints > JavaHintsTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.java.hints;
20
21 import junit.framework.TestSuite;
22 import org.netbeans.junit.NbTestSuite;
23
24
25 /**
26  * @author Jan Lahoda
27  */

28 public class JavaHintsTest extends JavaHintsTestBase {
29     
30     /** Need to be defined because of JUnit */
31     public JavaHintsTest(String JavaDoc name) {
32         super(name);
33         
34     }
35     
36 // public static TestSuite suite() {
37
// NbTestSuite suite = new NbTestSuite();
38
//
39
// suite.addTest(new JavaHintsTest("testImplementAbstractMethodsHint9"));
40
// suite.addTest(new JavaHintsTest("testImplementAbstractMethodsHint10"));
41
// suite.addTest(new JavaHintsTest("testImplementAbstractMethodsHint11"));
42
//// suite.addTest(new JavaHintsTest("testMakeClassAbstract3"));
43
//
44
// return suite;
45
// }
46

47 //
48
// public void testImplementAbstractMethodsHint1() throws Exception {
49
// performTest("ImplementAbstractMethods1", "Implement", 16, 60);
50
// }
51
//
52
// public void testImplementAbstractMethodsHint2() throws Exception {
53
// performTest("ImplementAbstractMethods2", "Implement", 17, 15);
54
// }
55
//
56
// public void testImplementAbstractMethodsHint3() throws Exception {
57
// performTest("ImplementAbstractMethods3", "Implement", 17, 25);
58
// }
59
//
60
// public void testImplementAbstractMethodsHint4() throws Exception {
61
// performTest("ImplementAbstractMethods4", "Implement", 16, 30);
62
// }
63
//
64
// public void testImplementAbstractMethodsHint5() throws Exception {
65
// performTest("ImplementAbstractMethods5", "Implement", 16, 30);
66
// }
67
//
68
// public void testImplementAbstractMethodsHint6() throws Exception {
69
// performTest("ImplementAbstractMethods6", "Implement", 8, 5);
70
// }
71
//
72
// public void testImplementAbstractMethodsHint7() throws Exception {
73
// performTest("ImplementAbstractMethods7", "Implement", 9, 25);
74
// }
75
//
76
// public void testImplementAbstractMethodsHint8() throws Exception {
77
// performTest("ImplementAbstractMethods8", "Implement", 12, 43);
78
// }
79

80     public void testImplementAbstractMethodsHint9() throws Exception JavaDoc {
81         performTestDoNotPerform("ImplementAbstractMethods9", 8, 15);
82     }
83
84     public void testImplementAbstractMethodsHint10() throws Exception JavaDoc {
85         performTestDoNotPerform("ImplementAbstractMethods10", 8, 15);
86     }
87     
88     public void testImplementAbstractMethodsHint11() throws Exception JavaDoc {
89         performTest("ImplementAbstractMethods11", "Implement", 8, 15);
90     }
91     
92 // public void testAddSemicolonHint() throws Exception {
93
// performTest("org.netbeans.test.java.hints.AddSemicolon", "semicolon", 17, 15);
94
// }
95
//
96
public void testAddCastHint1() throws Exception JavaDoc {
97         performTest("org.netbeans.test.java.hints.AddCast1", "Cast", 18, 15);
98     }
99     
100     public void testAddCastHint2() throws Exception JavaDoc {
101         performTest("org.netbeans.test.java.hints.AddCast2", "Cast", 20, 13);
102     }
103     
104     public void testAddCastHint3() throws Exception JavaDoc {
105         performTest("org.netbeans.test.java.hints.AddCast3", "Cast", 20, 20);
106     }
107     
108     public void testAddCastHint4() throws Exception JavaDoc {
109         performTest("org.netbeans.test.java.hints.AddCast4", "Cast", 22, 10);
110     }
111     
112     public void testAddCastHint5() throws Exception JavaDoc {
113         performTest("org.netbeans.test.java.hints.AddCast5", "Cast", 12, 1);
114     }
115     
116     public void testAddCastHint6() throws Exception JavaDoc {
117         performTest("org.netbeans.test.java.hints.AddCast6", "Cast", 13, 23);
118     }
119     
120     public void testAddCastHint7() throws Exception JavaDoc {
121         performTest("org.netbeans.test.java.hints.AddCast7", "Cast", 12, 18);
122     }
123     
124     public void testAddCastHint8() throws Exception JavaDoc {
125         performTest("org.netbeans.test.java.hints.AddCast8", "Cast", 13, 18);
126     }
127     
128     public void testAddCastHint9() throws Exception JavaDoc {
129         //should not cause exception
130
//also tests Create field hint, which should not be proposed in this case:
131
performTestDoNotPerform("org.netbeans.test.java.hints.AddCast9", 11, 18);
132     }
133     
134     public void testAddCastHint10() throws Exception JavaDoc {
135         //should not cause exception
136
performTest("org.netbeans.test.java.hints.AddCast10", "Cast", 13, 18);
137     }
138     
139     public void testAddCastHint11() throws Exception JavaDoc {
140         performTestDoNotPerform("org.netbeans.test.java.hints.AddCast11", 12, 18);
141     }
142     
143     public void testAddCastHintDoNotPropose() throws Exception JavaDoc {
144         //should not propose "cast to ..." hint if the actual problem is an undefined method
145
performTestDoNotPerform("org.netbeans.test.java.hints.AddCastDoNotPropose", 9, 18);
146     }
147     
148     public void testAddThrowsClauseHint1() throws Exception JavaDoc {
149         performTest("org.netbeans.test.java.hints.AddThrowsClause1", "throws", 19, 30);
150     }
151     
152     public void testAddThrowsClauseHint2() throws Exception JavaDoc {
153         performTest("org.netbeans.test.java.hints.AddThrowsClause2", "throws", 22, 30);
154     }
155     
156     public void testAddThrowsClauseHint3() throws Exception JavaDoc {
157         performTest("org.netbeans.test.java.hints.AddThrowsClause3", "throws", 11, 30);
158     }
159     
160     public void testAddThrowsClauseHint4() throws Exception JavaDoc {
161         performTest("org.netbeans.test.java.hints.AddThrowsClause4", "throws", 11, 30);
162     }
163     
164     /**tests only if an exception is thrown during hints creation of errors for this file
165      */

166     public void testCreateElementException() throws Exception JavaDoc {
167         performTestDoNotPerform("org.netbeans.test.java.hints.CreateElementException", 10, 27);
168     }
169     
170 // /**tests if an exception is thrown when the hint is approved:
171
// */
172
// public void testCreateFieldException() throws Exception {
173
// performTest("org.netbeans.test.java.hints.CreateFieldException", "field", 17, 31);
174
// }
175

176     public void testCreateFieldException2() throws Exception JavaDoc {
177         performTestDoNotPerform("org.netbeans.test.java.hints.CreateFieldException2", 8, 15);
178     }
179     
180     public void testCreateFieldException3() throws Exception JavaDoc {
181         performTestDoNotPerform("org.netbeans.test.java.hints.CreateFieldException3", 9, 15);
182     }
183     
184 // public void testCreateElement1() throws Exception {
185
// performTest("org.netbeans.test.java.hints.CreateElement1", "method", 23, 16);
186
// }
187
//
188
// public void testCreateElement2() throws Exception {
189
// performTest("org.netbeans.test.java.hints.CreateElement2", "method", 23, 16);
190
// }
191
//
192
// public void testCreateElement3() throws Exception {
193
// performTest("org.netbeans.test.java.hints.CreateElement3", "method", 24, 16);
194
// }
195
//
196
// public void testCreateElement4() throws Exception {
197
// performTest("org.netbeans.test.java.hints.CreateElement4", "method", 23, 16);
198
// }
199
//
200
// public void testCreateElement5() throws Exception {
201
// performTest("org.netbeans.test.java.hints.CreateElement5", "method", 23, 16);
202
// }
203
//
204
// public void testCreateElement6() throws Exception {
205
// performTest("org.netbeans.test.java.hints.CreateElement6", "method", 23, 16);
206
// }
207
//
208
// public void testCreateElement7() throws Exception {
209
// performTest("org.netbeans.test.java.hints.CreateElement7", "method", 23, 16);
210
// }
211
//
212
// public void testCreateElement8() throws Exception {
213
// performTest("org.netbeans.test.java.hints.CreateElement8", "method", 24, 16);
214
// }
215
//
216
// public void testCreateElement9() throws Exception {
217
// performTest("org.netbeans.test.java.hints.CreateElement9", "method", 23, 16);
218
// }
219
//
220
// public void testCreateElementa() throws Exception {
221
// performTest("org.netbeans.test.java.hints.CreateElementa", "method", 23, 16);
222
// }
223
//
224

225     public void testCreateField1() throws Exception JavaDoc {
226         performTest("org.netbeans.test.java.hints.CreateField1", "field", 23, 18);
227     }
228     
229     public void testCreateField2() throws Exception JavaDoc {
230         performTest("org.netbeans.test.java.hints.CreateField2", "field", 23, 20);
231     }
232     
233     public void testCreateField3() throws Exception JavaDoc {
234         performTest("org.netbeans.test.java.hints.CreateField3", "field", 23, 20);
235     }
236     
237 // public void testCreateField4() throws Exception {
238
// performTest("org.netbeans.test.java.hints.CreateField4", "field", 23, 20);
239
// }
240

241     public void testCreateField5() throws Exception JavaDoc {
242         performTest("org.netbeans.test.java.hints.CreateField5", "field", 23, 18);
243     }
244     
245     public void testCreateField6() throws Exception JavaDoc {
246         performTest("org.netbeans.test.java.hints.CreateField6", "field", 25, 18);
247     }
248     
249     public void testCreateField7() throws Exception JavaDoc {
250         performTestDoNotPerform("org.netbeans.test.java.hints.CreateField7", 9, 18);
251     }
252     
253     //Create field which type is a type varaible, does not work yet:
254
// public void testCreateField8() throws Exception {
255
// performTest("org.netbeans.test.java.hints.CreateField8", "field", 6, 18);
256
// }
257

258     public void testCreateField10() throws Exception JavaDoc {
259         performTest("org.netbeans.test.java.hints.CreateField10", "field", 9, 10);
260     }
261     
262     public void testCreateFieldPrimitive() throws Exception JavaDoc {
263         performTest("org.netbeans.test.java.hints.CreateFieldPrimitive", "field", 23, 13);
264     }
265     
266 // public void testCreateFieldMethod1() throws Exception {
267
// performTest("org.netbeans.test.java.hints.CreateFieldMethod1", "field", 23, 13);
268
// }
269

270     public void testCreateFieldMethod2() throws Exception JavaDoc {
271         performTest("org.netbeans.test.java.hints.CreateFieldMethod2", "field", 23, 13);
272     }
273     
274 // public void testDoNotProposeCreateField1() throws Exception {
275
// performTestDoNotPerform("org.netbeans.test.java.hints.DoNotProposeCreateField1",9, 18);
276
// }
277
//
278
public void testDoNotProposeCreateField2() throws Exception JavaDoc {
279         performTestDoNotPerform("org.netbeans.test.java.hints.DoNotProposeCreateField2", 7, 10);
280     }
281     
282 // public void testTryWrapper1() throws Exception {
283
// performTest("org.netbeans.test.java.hints.TryWrapper1", "try-catch", 19, 30);
284
// }
285
// public void testTryWrapper2() throws Exception {
286
// performTest("org.netbeans.test.java.hints.TryWrapper2", "try-catch", 19, 30);
287
// }
288
// public void testTryWrapper3() throws Exception {
289
// performTest("org.netbeans.test.java.hints.TryWrapper3", "try-catch", 20, 30);
290
// }
291
// public void testTryWrapper4() throws Exception {
292
// performTest("org.netbeans.test.java.hints.TryWrapper4", "try-catch", 19, 30);
293
// }
294
// public void testTryWrapper5() throws Exception {
295
// performTest("org.netbeans.test.java.hints.TryWrapper5", "try-catch", 19, 30);
296
// }
297
// public void testTryWrapper6() throws Exception {
298
// performTest("org.netbeans.test.java.hints.TryWrapper6", "try-catch", 19, 30);
299
// }
300
// public void testTryWrapper7() throws Exception {
301
// performTest("org.netbeans.test.java.hints.TryWrapper7", "try-catch", 19, 30);
302
// }
303
// public void testTryWrapper8() throws Exception {
304
// performTest("org.netbeans.test.java.hints.TryWrapper8", "try-catch", 21, 30);
305
// }
306
// public void testTryWrapper9() throws Exception {
307
// performTest("org.netbeans.test.java.hints.TryWrapper9", "try-catch", 19, 30);
308
// }
309
//
310
// public void testLocalAndParamIncorrect57990a() throws Exception {
311
// performTestDoNotPerform("org.netbeans.test.java.hints.LocalVarParam57990a", 23, 20);
312
// }
313
//
314
//// public void testLocalAndParamIncorrect57990b() throws Exception {
315
//// performTestDoNotPerform("org.netbeans.test.java.hints.LocalVarParam57990b", 23, 20);
316
//// }
317
//
318
// public void testLocalAndParamIncorrect57990c() throws Exception {
319
// performTestDoNotPerform("org.netbeans.test.java.hints.LocalVarParam57990c", 23, 20);
320
// }
321

322     public void testCreateLocalVariable1() throws Exception JavaDoc {
323         performTest("org.netbeans.test.java.hints.CreateLocalVariable1", "local", 23, 15);
324     }
325     
326 // public void testCreateLocalVariable2() throws Exception {
327
// performTest("org.netbeans.test.java.hints.CreateLocalVariable2", "local", 19, 20);
328
// }
329

330     public void testCreateLocalVariable3() throws Exception JavaDoc {
331         performTest("org.netbeans.test.java.hints.CreateLocalVariable3", "local", 20, 20);
332     }
333     
334     public void testCreateLocalVariable4() throws Exception JavaDoc {
335         performTest("org.netbeans.test.java.hints.CreateLocalVariable4", "local", 8, 18);
336     }
337     
338     public void testCreateLocalVariable5() throws Exception JavaDoc {
339         performTest("org.netbeans.test.java.hints.CreateLocalVariable5", "local", 8, 18);
340     }
341     
342     public void testCreateLocalVariable6() throws Exception JavaDoc {
343         performTest("org.netbeans.test.java.hints.CreateLocalVariable6", "local", 8, 18);
344     }
345     
346     public void testCreateLocalVariable7() throws Exception JavaDoc {
347         performTest("org.netbeans.test.java.hints.CreateLocalVariable7", "local", 10, 18);
348     }
349     
350     public void testCreateLocalVariable8() throws Exception JavaDoc {
351         performTest("org.netbeans.test.java.hints.CreateLocalVariable8", "local", 9, 18);
352     }
353     
354     public void testCreateLocalVariable9() throws Exception JavaDoc {
355         performTest("org.netbeans.test.java.hints.CreateLocalVariable9", "local", 11, 18);
356     }
357     
358     public void testCreateLocalVariable10() throws Exception JavaDoc {
359         performTest("org.netbeans.test.java.hints.CreateLocalVariable10", "local", 10, 18);
360     }
361     
362     public void testCreateParam1() throws Exception JavaDoc {
363         performTest("org.netbeans.test.java.hints.CreateParam1", "parameter", 23, 15);
364     }
365     
366     public void testCreateParam2() throws Exception JavaDoc {
367         performTest("org.netbeans.test.java.hints.CreateParam2", "parameter", 20, 15);
368     }
369     
370     public void testCreateParam3() throws Exception JavaDoc {
371         performTest("org.netbeans.test.java.hints.CreateParam3", "parameter", 20, 15);
372     }
373     
374     public void testCreateParam4() throws Exception JavaDoc {
375         performTest("org.netbeans.test.java.hints.CreateParam4", "parameter", 9, 15);
376     }
377     
378     public void testCreateParam5() throws Exception JavaDoc {
379         performTest("org.netbeans.test.java.hints.CreateParam5", "parameter", 10, 15);
380     }
381     
382 // public void testIncorrectType57991() throws Exception {
383
// performTest("org.netbeans.test.java.hints.IncorrectType57991", "field", 23, 20);
384
// }
385
//
386
// public void testImportBeforeCreateElement() throws Exception {
387
// performTestDoNotPerform("org.netbeans.test.java.hints.ImportBeforeCreateElement", 10, 21);
388
// }
389
//
390
// public void testIncorrectType58119a() throws Exception {
391
// performTest("org.netbeans.test.java.hints.IncorrectType58119a", "field", 11, 9);
392
// }
393
//
394
// public void testIncorrectType58119b() throws Exception {
395
// performTest("org.netbeans.test.java.hints.IncorrectType58119b", "parameter", 9, 9);
396
// }
397
//
398
// public void testIncorrectType58119c() throws Exception {
399
// performTest("org.netbeans.test.java.hints.IncorrectType58119c", "local", 9, 9);
400
// }
401
//
402
// public void testIncorrectType58119d() throws Exception {
403
// performTest(
404
// "org.netbeans.test.java.hints.IncorrectType58119d",
405
// "org.netbeans.test.java.hints.IncorrectType58119d", "Create", 13, 37, false);
406
// }
407
//
408
// public void testIncorrectType58119e() throws Exception {
409
// performTest(
410
// "org.netbeans.test.java.hints.IncorrectType58119f",
411
// "org.netbeans.test.java.hints.IncorrectType58119e", "Create", 12, 24, false);
412
// }
413
//
414
// public void testTypeFromParama() throws Exception {
415
// performTest(
416
// "org.netbeans.test.java.hints.TypeFromParama",
417
// "org.netbeans.test.java.hints.TypeFromParama", "field", 12, 9, false);
418
// }
419
//
420
// public void testTypeFromParamb() throws Exception {
421
// performTest(
422
// "org.netbeans.test.java.hints.TypeFromParamb",
423
// "org.netbeans.test.java.hints.TypeFromParamb", "field", 12, 9, false);
424
// }
425
//
426
// public void testCastOrMethodInvocation58494a() throws Exception {
427
// performTest("org.netbeans.test.java.hints.CastOrMethodInvocation58494a", "Cast ...", 12, 14);
428
// }
429
//
430
// public void testCastOrMethodInvocation58494b() throws Exception {
431
// performTest("org.netbeans.test.java.hints.CastOrMethodInvocation58494b", "Cast ...", 13, 18);
432
// }
433
//
434
// public void testCastOrMethodInvocation58494e() throws Exception {
435
// performTestDoNotPerform("org.netbeans.test.java.hints.CastOrMethodInvocation58494e", 11, 24);
436
// }
437
//
438
// public void testCastOrMethodInvocation58494g() throws Exception {
439
// performTestDoNotPerform("org.netbeans.test.java.hints.CastOrMethodInvocation58494g", 13, 9);
440
// }
441
//
442
// public void testCastOrMethodInvocation58494h() throws Exception {
443
// performTestDoNotPerform("org.netbeans.test.java.hints.CastOrMethodInvocation58494h", 11, 22);
444
// }
445
//
446
// public void testInitializeVariable1() throws Exception {
447
// performTest("org.netbeans.test.java.hints.InitializeVariable1", "Initialize", 13, 17);
448
// }
449
//
450
// public void testInitializeVariable2() throws Exception {
451
// performTest("org.netbeans.test.java.hints.InitializeVariable2", "Initialize", 12, 17);
452
// }
453
//
454
// public void testInitializeVariable3() throws Exception {
455
// performTest("org.netbeans.test.java.hints.InitializeVariable3", "Initialize", 10, 1);
456
// }
457

458     public void testNonAbstractClass85806() throws Exception JavaDoc {
459         performTestDoNotPerform("org.netbeans.test.java.hints.AbstractClass4", 8, 1);
460     }
461     
462     public void testMakeClassAbstract1() throws Exception JavaDoc {
463         performTest("org.netbeans.test.java.hints.MakeClassAbstract1", "abstract", 3, 1);
464     }
465     
466     public void testMakeClassAbstract2() throws Exception JavaDoc {
467         performTest("org.netbeans.test.java.hints.MakeClassAbstract2", "abstract", 3, 1);
468     }
469     
470     public void testMakeClassAbstract3() throws Exception JavaDoc {
471         performTest("org.netbeans.test.java.hints.MakeClassAbstract3", "abstract", 3, 1);
472     }
473     
474     @Override JavaDoc
475     protected boolean createCaches() {
476         return false;
477     }
478     
479 }
480
Popular Tags