41 |
41 |
42 @DataProvider(name = "ignoredModifiers") |
42 @DataProvider(name = "ignoredModifiers") |
43 public Object[][] getTestCases() { |
43 public Object[][] getTestCases() { |
44 List<Object[]> testCases = new ArrayList<>(); |
44 List<Object[]> testCases = new ArrayList<>(); |
45 String[] ignoredModifiers = new String[] { |
45 String[] ignoredModifiers = new String[] { |
46 "public", "protected", "private", "static", "final" |
46 "static", "final" |
47 }; |
47 }; |
48 for (String ignoredModifier : ignoredModifiers) { |
48 for (String ignoredModifier : ignoredModifiers) { |
49 for (ClassType classType : ClassType.values()) { |
49 for (ClassType classType : ClassType.values()) { |
50 testCases.add(new Object[] { ignoredModifier, classType }); |
50 testCases.add(new Object[] { ignoredModifier, classType }); |
51 } |
51 } |
55 |
55 |
56 @Test(dataProvider = "ignoredModifiers") |
56 @Test(dataProvider = "ignoredModifiers") |
57 public void ignoredModifiers(String modifier, ClassType classType) { |
57 public void ignoredModifiers(String modifier, ClassType classType) { |
58 assertDeclareWarn1( |
58 assertDeclareWarn1( |
59 String.format("%s %s A {}", modifier, classType), "jdk.eval.warn.illegal.modifiers"); |
59 String.format("%s %s A {}", modifier, classType), "jdk.eval.warn.illegal.modifiers"); |
|
60 assertNumberOfActiveClasses(1); |
|
61 assertClasses(clazz(classType, "A")); |
|
62 assertActiveKeys(); |
|
63 } |
|
64 |
|
65 @DataProvider(name = "silentlyIgnoredModifiers") |
|
66 public Object[][] getSilentTestCases() { |
|
67 List<Object[]> testCases = new ArrayList<>(); |
|
68 String[] ignoredModifiers = new String[] { |
|
69 "public", "protected", "private" |
|
70 }; |
|
71 for (String ignoredModifier : ignoredModifiers) { |
|
72 for (ClassType classType : ClassType.values()) { |
|
73 testCases.add(new Object[] { ignoredModifier, classType }); |
|
74 } |
|
75 } |
|
76 return testCases.toArray(new Object[testCases.size()][]); |
|
77 } |
|
78 |
|
79 @Test(dataProvider = "silentlyIgnoredModifiers") |
|
80 public void silentlyIgnoredModifiers(String modifier, ClassType classType) { |
|
81 assertEval(String.format("%s %s A {}", modifier, classType)); |
60 assertNumberOfActiveClasses(1); |
82 assertNumberOfActiveClasses(1); |
61 assertClasses(clazz(classType, "A")); |
83 assertClasses(clazz(classType, "A")); |
62 assertActiveKeys(); |
84 assertActiveKeys(); |
63 } |
85 } |
64 |
86 |