View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code for adherence to a set of rules.
3   // Copyright (C) 2001-2018 the original author or authors.
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ////////////////////////////////////////////////////////////////////////////////
19  
20  package com.puppycrawl.tools.checkstyle.checks.design;
21  
22  import static com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck.MSG_KEY;
23  import static org.junit.Assert.assertArrayEquals;
24  import static org.junit.Assert.assertEquals;
25  import static org.junit.Assert.assertTrue;
26  import static org.junit.Assert.fail;
27  
28  import java.io.File;
29  import java.lang.reflect.Method;
30  
31  import org.junit.Test;
32  import org.powermock.reflect.Whitebox;
33  
34  import antlr.CommonHiddenStreamToken;
35  import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
36  import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
37  import com.puppycrawl.tools.checkstyle.JavaParser;
38  import com.puppycrawl.tools.checkstyle.api.DetailAST;
39  import com.puppycrawl.tools.checkstyle.api.TokenTypes;
40  import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
41  
42  public class VisibilityModifierCheckTest
43      extends AbstractModuleTestSupport {
44  
45      @Override
46      protected String getPackageLocation() {
47          return "com/puppycrawl/tools/checkstyle/checks/design/visibilitymodifier";
48      }
49  
50      @Test
51      public void testGetRequiredTokens() {
52          final VisibilityModifierCheck checkObj = new VisibilityModifierCheck();
53          final int[] expected = {
54              TokenTypes.VARIABLE_DEF,
55              TokenTypes.IMPORT,
56          };
57          assertArrayEquals("Default required tokens are invalid",
58              expected, checkObj.getRequiredTokens());
59      }
60  
61      @Test
62      public void testInner()
63              throws Exception {
64          final DefaultConfiguration checkConfig =
65                  createModuleConfig(VisibilityModifierCheck.class);
66          checkConfig.addAttribute("publicMemberPattern", "^f[A-Z][a-zA-Z0-9]*$");
67          final String[] expected = {
68              "30:24: " + getCheckMessage(MSG_KEY, "rData"),
69              "33:27: " + getCheckMessage(MSG_KEY, "protectedVariable"),
70              "36:17: " + getCheckMessage(MSG_KEY, "packageVariable"),
71              "41:29: " + getCheckMessage(MSG_KEY, "sWeird"),
72              "43:19: " + getCheckMessage(MSG_KEY, "sWeird2"),
73              "77:20: " + getCheckMessage(MSG_KEY, "someValue"),
74          };
75          verify(checkConfig, getPath("InputVisibilityModifierInner.java"), expected);
76      }
77  
78      @Test
79      public void testIgnoreAccess()
80              throws Exception {
81          final DefaultConfiguration checkConfig =
82              createModuleConfig(VisibilityModifierCheck.class);
83          checkConfig.addAttribute("publicMemberPattern", "^r[A-Z]");
84          checkConfig.addAttribute("protectedAllowed", "true");
85          checkConfig.addAttribute("packageAllowed", "true");
86          final String[] expected = {
87              "17:20: " + getCheckMessage(MSG_KEY, "fData"),
88              "77:20: " + getCheckMessage(MSG_KEY, "someValue"),
89          };
90          verify(checkConfig, getPath("InputVisibilityModifierInner.java"), expected);
91      }
92  
93      @Test
94      public void testSimple() throws Exception {
95          final DefaultConfiguration checkConfig =
96                  createModuleConfig(VisibilityModifierCheck.class);
97          checkConfig.addAttribute("publicMemberPattern", "^f[A-Z][a-zA-Z0-9]*$");
98          final String[] expected = {
99              "33:19: " + getCheckMessage(MSG_KEY, "mNumCreated2"),
100             "43:23: " + getCheckMessage(MSG_KEY, "sTest1"),
101             "45:26: " + getCheckMessage(MSG_KEY, "sTest3"),
102             "47:16: " + getCheckMessage(MSG_KEY, "sTest2"),
103             "50:9: " + getCheckMessage(MSG_KEY, "mTest1"),
104             "52:16: " + getCheckMessage(MSG_KEY, "mTest2"),
105         };
106         verify(checkConfig, getPath("InputVisibilityModifierSimple.java"), expected);
107     }
108 
109     @Test
110     public void testStrictJavadoc() throws Exception {
111         final DefaultConfiguration checkConfig =
112                 createModuleConfig(VisibilityModifierCheck.class);
113         checkConfig.addAttribute("publicMemberPattern", "^f[A-Z][a-zA-Z0-9]*$");
114         final String[] expected = {
115             "32:9: " + getCheckMessage(MSG_KEY, "mLen"),
116             "33:19: " + getCheckMessage(MSG_KEY, "mDeer"),
117             "34:16: " + getCheckMessage(MSG_KEY, "aFreddo"),
118         };
119         verify(checkConfig, getPath("InputVisibilityModifierPublicOnly.java"), expected);
120     }
121 
122     @Test
123     public void testAllowPublicFinalFieldsInImmutableClass() throws Exception {
124         final DefaultConfiguration checkConfig =
125                 createModuleConfig(VisibilityModifierCheck.class);
126         checkConfig.addAttribute("allowPublicImmutableFields", "true");
127         final String[] expected = {
128             "12:39: " + getCheckMessage(MSG_KEY, "includes"),
129             "13:39: " + getCheckMessage(MSG_KEY, "excludes"),
130             "16:23: " + getCheckMessage(MSG_KEY, "list"),
131             "34:20: " + getCheckMessage(MSG_KEY, "value"),
132             "36:24: " + getCheckMessage(MSG_KEY, "bValue"),
133             "37:31: " + getCheckMessage(MSG_KEY, "longValue"),
134         };
135         verify(checkConfig, getPath("InputVisibilityModifierImmutable.java"), expected);
136     }
137 
138     @Test
139     public void testDisAllowPublicFinalAndImmutableFieldsInImmutableClass() throws Exception {
140         final DefaultConfiguration checkConfig =
141             createModuleConfig(VisibilityModifierCheck.class);
142         final String[] expected = {
143             "11:22: " + getCheckMessage(MSG_KEY, "someIntValue"),
144             "12:39: " + getCheckMessage(MSG_KEY, "includes"),
145             "13:39: " + getCheckMessage(MSG_KEY, "excludes"),
146             "14:35: " + getCheckMessage(MSG_KEY, "notes"),
147             "15:29: " + getCheckMessage(MSG_KEY, "money"),
148             "16:23: " + getCheckMessage(MSG_KEY, "list"),
149             "30:28: " + getCheckMessage(MSG_KEY, "f"),
150             "31:30: " + getCheckMessage(MSG_KEY, "bool"),
151             "32:35: " + getCheckMessage(MSG_KEY, "uri"),
152             "33:35: " + getCheckMessage(MSG_KEY, "file"),
153             "34:20: " + getCheckMessage(MSG_KEY, "value"),
154             "35:35: " + getCheckMessage(MSG_KEY, "url"),
155             "36:24: " + getCheckMessage(MSG_KEY, "bValue"),
156             "37:31: " + getCheckMessage(MSG_KEY, "longValue"),
157             };
158         verify(checkConfig, getPath("InputVisibilityModifierImmutable.java"), expected);
159     }
160 
161     @Test
162     public void testAllowPublicFinalFieldsInNonFinalClass() throws Exception {
163         final DefaultConfiguration checkConfig =
164                 createModuleConfig(VisibilityModifierCheck.class);
165         checkConfig.addAttribute("allowPublicFinalFields", "true");
166         final String[] expected = {
167             "34:20: " + getCheckMessage(MSG_KEY, "value"),
168             "36:24: " + getCheckMessage(MSG_KEY, "bValue"),
169             "37:31: " + getCheckMessage(MSG_KEY, "longValue"),
170         };
171         verify(checkConfig, getPath("InputVisibilityModifierImmutable.java"), expected);
172     }
173 
174     @Test
175     public void testUserSpecifiedImmutableClassesList() throws Exception {
176         final DefaultConfiguration checkConfig =
177                 createModuleConfig(VisibilityModifierCheck.class);
178         checkConfig.addAttribute("allowPublicImmutableFields", "true");
179         checkConfig.addAttribute("immutableClassCanonicalNames", "java.util.List,"
180                 + "com.google.common.collect.ImmutableSet, java.lang.String");
181         final String[] expected = {
182             "15:29: " + getCheckMessage(MSG_KEY, "money"),
183             "32:35: " + getCheckMessage(MSG_KEY, "uri"),
184             "33:35: " + getCheckMessage(MSG_KEY, "file"),
185             "34:20: " + getCheckMessage(MSG_KEY, "value"),
186             "35:35: " + getCheckMessage(MSG_KEY, "url"),
187             "36:24: " + getCheckMessage(MSG_KEY, "bValue"),
188             "37:31: " + getCheckMessage(MSG_KEY, "longValue"),
189         };
190         verify(checkConfig, getPath("InputVisibilityModifierImmutable.java"), expected);
191     }
192 
193     @Test
194     public void testImmutableSpecifiedSameTypeName() throws Exception {
195         final DefaultConfiguration checkConfig =
196                 createModuleConfig(VisibilityModifierCheck.class);
197         checkConfig.addAttribute("allowPublicImmutableFields", "true");
198         checkConfig.addAttribute("immutableClassCanonicalNames",
199                  "com.puppycrawl.tools.checkstyle.checks.design."
200                          + "visibilitymodifier.InputVisibilityModifierGregorianCalendar,"
201                  + "com.puppycrawl.tools.checkstyle.checks.design."
202                          + "visibilitymodifier.inputs.InetSocketAddress");
203         final String[] expected = {
204             "7:46: " + getCheckMessage(MSG_KEY, "calendar"),
205             "12:45: " + getCheckMessage(MSG_KEY, "adr"),
206         };
207         verify(checkConfig, getPath("InputVisibilityModifierImmutableSameTypeName.java"),
208                 expected);
209     }
210 
211     @Test
212     public void testImmutableValueSameTypeName() throws Exception {
213         final DefaultConfiguration checkConfig =
214                 createModuleConfig(VisibilityModifierCheck.class);
215         checkConfig.addAttribute("allowPublicImmutableFields", "true");
216         final String[] expected = {
217             "7:46: " + getCheckMessage(MSG_KEY, "calendar"),
218             "8:59: " + getCheckMessage(MSG_KEY, "calendar2"),
219             "10:73: " + getCheckMessage(MSG_KEY, "calendar3"),
220             "11:36: " + getCheckMessage(MSG_KEY, "address"),
221         };
222         verify(checkConfig, getPath("InputVisibilityModifierImmutableSameTypeName.java"),
223                 expected);
224     }
225 
226     @Test
227     public void testImmutableStarImportFalseNegative() throws Exception {
228         final DefaultConfiguration checkConfig =
229                 createModuleConfig(VisibilityModifierCheck.class);
230         checkConfig.addAttribute("allowPublicImmutableFields", "true");
231         checkConfig.addAttribute("immutableClassCanonicalNames", "java.util.Arrays");
232         final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
233         verify(checkConfig, getPath("InputVisibilityModifierImmutableStarImport.java"), expected);
234     }
235 
236     @Test
237     public void testImmutableStarImportNoWarn() throws Exception {
238         final DefaultConfiguration checkConfig =
239                 createModuleConfig(VisibilityModifierCheck.class);
240         checkConfig.addAttribute("allowPublicImmutableFields", "true");
241         checkConfig.addAttribute("immutableClassCanonicalNames",
242             "java.lang.String, com.google.common.collect.ImmutableSet");
243         final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
244         verify(checkConfig, getPath("InputVisibilityModifierImmutableStarImport2.java"),
245                 expected);
246     }
247 
248     @Test
249     public void testDefaultAnnotationPatterns() throws Exception {
250         final DefaultConfiguration checkConfig =
251             createModuleConfig(VisibilityModifierCheck.class);
252         final String[] expected = {
253             "40:19: " + getCheckMessage(MSG_KEY, "customAnnotatedPublic"),
254             "43:12: " + getCheckMessage(MSG_KEY, "customAnnotatedPackage"),
255             "46:22: " + getCheckMessage(MSG_KEY, "customAnnotatedProtected"),
256             "48:19: " + getCheckMessage(MSG_KEY, "unannotatedPublic"),
257             "49:12: " + getCheckMessage(MSG_KEY, "unannotatedPackage"),
258             "50:22: " + getCheckMessage(MSG_KEY, "unannotatedProtected"),
259         };
260         verify(checkConfig, getPath("InputVisibilityModifierAnnotated.java"), expected);
261     }
262 
263     @Test
264     public void testCustomAnnotationPatterns() throws Exception {
265         final DefaultConfiguration checkConfig =
266             createModuleConfig(VisibilityModifierCheck.class);
267         checkConfig.addAttribute("ignoreAnnotationCanonicalNames",
268                 "com.puppycrawl.tools.checkstyle.checks.design."
269                     + "InputVisibilityModifierAnnotated.CustomAnnotation");
270         final String[] expected = {
271             "16:28: " + getCheckMessage(MSG_KEY, "publicJUnitRule"),
272             "19:28: " + getCheckMessage(MSG_KEY, "fqPublicJUnitRule"),
273             "22:19: " + getCheckMessage(MSG_KEY, "googleCommonsAnnotatedPublic"),
274             "25:12: " + getCheckMessage(MSG_KEY, "googleCommonsAnnotatedPackage"),
275             "28:22: " + getCheckMessage(MSG_KEY, "googleCommonsAnnotatedProtected"),
276             "31:19: " + getCheckMessage(MSG_KEY, "fqGoogleCommonsAnnotatedPublic"),
277             "34:12: " + getCheckMessage(MSG_KEY, "fqGoogleCommonsAnnotatedPackage"),
278             "37:22: " + getCheckMessage(MSG_KEY, "fqGoogleCommonsAnnotatedProtected"),
279             "48:19: " + getCheckMessage(MSG_KEY, "unannotatedPublic"),
280             "49:12: " + getCheckMessage(MSG_KEY, "unannotatedPackage"),
281             "50:22: " + getCheckMessage(MSG_KEY, "unannotatedProtected"),
282             "59:35: " + getCheckMessage(MSG_KEY, "publicJUnitClassRule"),
283             "62:35: " + getCheckMessage(MSG_KEY, "fqPublicJUnitClassRule"),
284         };
285         verify(checkConfig, getPath("InputVisibilityModifierAnnotated.java"), expected);
286     }
287 
288     @Test
289     public void testIgnoreAnnotationNoPattern() throws Exception {
290         final DefaultConfiguration checkConfig =
291             createModuleConfig(VisibilityModifierCheck.class);
292         checkConfig.addAttribute("ignoreAnnotationCanonicalNames", "");
293         final String[] expected = {
294             "16:28: " + getCheckMessage(MSG_KEY, "publicJUnitRule"),
295             "19:28: " + getCheckMessage(MSG_KEY, "fqPublicJUnitRule"),
296             "22:19: " + getCheckMessage(MSG_KEY, "googleCommonsAnnotatedPublic"),
297             "25:12: " + getCheckMessage(MSG_KEY, "googleCommonsAnnotatedPackage"),
298             "28:22: " + getCheckMessage(MSG_KEY, "googleCommonsAnnotatedProtected"),
299             "31:19: " + getCheckMessage(MSG_KEY, "fqGoogleCommonsAnnotatedPublic"),
300             "34:12: " + getCheckMessage(MSG_KEY, "fqGoogleCommonsAnnotatedPackage"),
301             "37:22: " + getCheckMessage(MSG_KEY, "fqGoogleCommonsAnnotatedProtected"),
302             "40:19: " + getCheckMessage(MSG_KEY, "customAnnotatedPublic"),
303             "43:12: " + getCheckMessage(MSG_KEY, "customAnnotatedPackage"),
304             "46:22: " + getCheckMessage(MSG_KEY, "customAnnotatedProtected"),
305             "48:19: " + getCheckMessage(MSG_KEY, "unannotatedPublic"),
306             "49:12: " + getCheckMessage(MSG_KEY, "unannotatedPackage"),
307             "50:22: " + getCheckMessage(MSG_KEY, "unannotatedProtected"),
308             "59:35: " + getCheckMessage(MSG_KEY, "publicJUnitClassRule"),
309             "62:35: " + getCheckMessage(MSG_KEY, "fqPublicJUnitClassRule"),
310         };
311         verify(checkConfig, getPath("InputVisibilityModifierAnnotated.java"), expected);
312     }
313 
314     @Test
315     public void testIgnoreAnnotationSameName() throws Exception {
316         final DefaultConfiguration checkConfig =
317             createModuleConfig(VisibilityModifierCheck.class);
318         final String[] expected = {
319             "11:28: " + getCheckMessage(MSG_KEY, "publicJUnitRule"),
320             "14:28: " + getCheckMessage(MSG_KEY, "publicJUnitClassRule"),
321         };
322         verify(checkConfig, getPath("InputVisibilityModifierAnnotatedSameTypeName.java"),
323                 expected);
324     }
325 
326     @Test
327     public void testGetAcceptableTokens() {
328         final VisibilityModifierCheck obj = new VisibilityModifierCheck();
329         final int[] expected = {
330             TokenTypes.VARIABLE_DEF,
331             TokenTypes.IMPORT,
332         };
333         assertArrayEquals("Default acceptable tokens are invalid",
334             expected, obj.getAcceptableTokens());
335     }
336 
337     @Test
338     public void testPublicImmutableFieldsNotAllowed() throws Exception {
339         final DefaultConfiguration checkConfig =
340             createModuleConfig(VisibilityModifierCheck.class);
341         final String[] expected = {
342             "10:22: " + getCheckMessage(MSG_KEY, "someIntValue"),
343             "11:39: " + getCheckMessage(MSG_KEY, "includes"),
344             "12:35: " + getCheckMessage(MSG_KEY, "notes"),
345             "13:29: " + getCheckMessage(MSG_KEY, "value"),
346             "14:23: " + getCheckMessage(MSG_KEY, "list"),
347         };
348         verify(checkConfig, getPath("InputVisibilityModifiersPublicImmutable.java"), expected);
349     }
350 
351     @Test
352     public void testPublicFinalFieldsNotAllowed() throws Exception {
353         final DefaultConfiguration checkConfig =
354             createModuleConfig(VisibilityModifierCheck.class);
355         final String[] expected = {
356             "10:22: " + getCheckMessage(MSG_KEY, "someIntValue"),
357             "11:39: " + getCheckMessage(MSG_KEY, "includes"),
358             "12:35: " + getCheckMessage(MSG_KEY, "notes"),
359             "13:29: " + getCheckMessage(MSG_KEY, "value"),
360             "14:23: " + getCheckMessage(MSG_KEY, "list"),
361         };
362         verify(checkConfig, getPath("InputVisibilityModifiersPublicImmutable.java"), expected);
363     }
364 
365     @Test
366     public void testPublicFinalFieldsAllowed() throws Exception {
367         final DefaultConfiguration checkConfig =
368             createModuleConfig(VisibilityModifierCheck.class);
369         checkConfig.addAttribute("allowPublicFinalFields", "true");
370         checkConfig.addAttribute("immutableClassCanonicalNames",
371             "com.google.common.collect.ImmutableSet");
372         final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
373         verify(checkConfig, getPath("InputVisibilityModifiersPublicImmutable.java"), expected);
374     }
375 
376     @Test
377     public void testPublicFinalFieldInEnum() throws Exception {
378         final DefaultConfiguration checkConfig =
379             createModuleConfig(VisibilityModifierCheck.class);
380         checkConfig.addAttribute("allowPublicImmutableFields", "true");
381         final String[] expected = {
382             "15:23: " + getCheckMessage(MSG_KEY, "hole"),
383         };
384         verify(checkConfig, getPath("InputVisibilityModifiersEnumIsSealed.java"), expected);
385     }
386 
387     @Test
388     public void testWrongTokenType() {
389         final VisibilityModifierCheck obj = new VisibilityModifierCheck();
390         final DetailAST ast = new DetailAST();
391         ast.initialize(new CommonHiddenStreamToken(TokenTypes.CLASS_DEF, "class"));
392         try {
393             obj.visitToken(ast);
394             fail("exception expected");
395         }
396         catch (IllegalArgumentException ex) {
397             assertEquals("Invalid exception message",
398                 "Unexpected token type: class", ex.getMessage());
399         }
400     }
401 
402     @Test
403     public void testNullModifiers() throws Exception {
404         final DefaultConfiguration checkConfig =
405             createModuleConfig(VisibilityModifierCheck.class);
406         checkConfig.addAttribute("allowPublicImmutableFields", "true");
407         final String[] expected = {
408             "11:50: " + getCheckMessage(MSG_KEY, "i"),
409         };
410         verify(checkConfig, getPath("InputVisibilityModifiersNullModifiers.java"), expected);
411     }
412 
413     @Test
414     public void testVisibilityModifiersOfGenericFields() throws Exception {
415         final DefaultConfiguration checkConfig =
416             createModuleConfig(VisibilityModifierCheck.class);
417         checkConfig.addAttribute("allowPublicImmutableFields", "true");
418         checkConfig.addAttribute("immutableClassCanonicalNames",
419             "com.google.common.collect.ImmutableMap,"
420             + "java.lang.String,"
421             + "java.util.Optional,"
422             + "java.math.BigDecimal");
423         final String[] expected = {
424             "16:56: " + getCheckMessage(MSG_KEY, "perfSeries"),
425             "17:66: " + getCheckMessage(MSG_KEY, "peopleMap"),
426             "18:66: " + getCheckMessage(MSG_KEY, "someMap"),
427             "19:76: " + getCheckMessage(MSG_KEY, "newMap"),
428             "21:45: " + getCheckMessage(MSG_KEY, "optionalOfObject"),
429             "22:35: " + getCheckMessage(MSG_KEY, "obj"),
430             "24:19: " + getCheckMessage(MSG_KEY, "rqUID"),
431             "25:29: " + getCheckMessage(MSG_KEY, "rqTime"),
432             "26:45: " + getCheckMessage(MSG_KEY, "rates"),
433             "27:50: " + getCheckMessage(MSG_KEY, "loans"),
434             "28:60: " + getCheckMessage(MSG_KEY, "cards"),
435             "29:60: " + getCheckMessage(MSG_KEY, "values"),
436             "30:70: " + getCheckMessage(MSG_KEY, "permissions"),
437             "32:38: " + getCheckMessage(MSG_KEY, "mapOfStrings"),
438             "33:48: " + getCheckMessage(MSG_KEY, "names"),
439             "34:48: " + getCheckMessage(MSG_KEY, "links"),
440             "35:38: " + getCheckMessage(MSG_KEY, "presentations"),
441             "36:48: " + getCheckMessage(MSG_KEY, "collection"),
442             "39:73: " + getCheckMessage(MSG_KEY, "exceptions"),
443         };
444         verify(checkConfig, getPath("InputVisibilityModifierGenerics.java"), expected);
445     }
446 
447     /**
448      * We can not cover this mutation because it force all imports to be non static,
449      * but static imports are ignored, so we will not see any affect on validation.
450      * We could remove this method at all, and it will work correctly as we can not use
451      * class with name "", but in this case internal collection will have short names
452      * as "" that will not make problems, but will be weird in debug.
453      *
454      * @throws Exception when exception occurred during execution.
455      */
456     @Test
457     public void testIsStarImportNullAst() throws Exception {
458         final DetailAST importAst = JavaParser.parseFile(
459             new File(getPath("InputVisibilityModifierIsStarImport.java")),
460             JavaParser.Options.WITHOUT_COMMENTS).getNextSibling();
461         final VisibilityModifierCheck check = new VisibilityModifierCheck();
462         final Method isStarImport = Whitebox.getMethod(VisibilityModifierCheck.class,
463             "isStarImport", DetailAST.class);
464 
465         assertTrue("Should return true when star import is passed",
466             (boolean) isStarImport.invoke(check, importAst));
467     }
468 
469 }