langtools/test/jdk/jshell/ModifiersTest.java
changeset 41858 5843b57ce3a6
parent 33362 65ec6de1d6b4
child 41940 048d559e9da7
--- a/langtools/test/jdk/jshell/ModifiersTest.java	Thu Oct 27 21:22:12 2016 +0000
+++ b/langtools/test/jdk/jshell/ModifiersTest.java	Thu Oct 27 17:11:16 2016 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * @test
+ * @test 8167643
  * @summary Tests for modifiers
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
  * @run testng ModifiersTest
@@ -43,7 +43,7 @@
     public Object[][] getTestCases() {
         List<Object[]> testCases = new ArrayList<>();
         String[] ignoredModifiers = new String[] {
-            "public", "protected", "private", "static", "final"
+            "static", "final"
         };
         for (String ignoredModifier : ignoredModifiers) {
             for (ClassType classType : ClassType.values()) {
@@ -62,6 +62,28 @@
         assertActiveKeys();
     }
 
+    @DataProvider(name = "silentlyIgnoredModifiers")
+    public Object[][] getSilentTestCases() {
+        List<Object[]> testCases = new ArrayList<>();
+        String[] ignoredModifiers = new String[] {
+            "public", "protected", "private"
+        };
+        for (String ignoredModifier : ignoredModifiers) {
+            for (ClassType classType : ClassType.values()) {
+                testCases.add(new Object[] { ignoredModifier, classType });
+            }
+        }
+        return testCases.toArray(new Object[testCases.size()][]);
+    }
+
+    @Test(dataProvider = "silentlyIgnoredModifiers")
+    public void silentlyIgnoredModifiers(String modifier, ClassType classType) {
+        assertEval(String.format("%s %s A {}", modifier, classType));
+        assertNumberOfActiveClasses(1);
+        assertClasses(clazz(classType, "A"));
+        assertActiveKeys();
+    }
+
     public void accessToStaticFieldsOfClass() {
         assertEval("class A {" +
                 "int x = 14;" +