You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/09/05 09:56:16 UTC

[GitHub] vikasprabhakar closed pull request #698: [NETBEANS-860] Hints: Update test cases

vikasprabhakar closed pull request #698: [NETBEANS-860] Hints: Update test cases
URL: https://github.com/apache/incubator-netbeans/pull/698
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties
index e774716f97..8f12d2f9e2 100644
--- a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties
+++ b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties
@@ -45,3 +45,5 @@ ERR_splitIfCondition=ERR_splitIfCondition
 
 HINT_ConvertIfToSwitch=HINT_ConvertIfToSwitch
 FIX_ConvertIfsToSwitch=FIX_ConvertIfsToSwitch
+
+ERR_ConvertVarLambdaParameters=ERR_ConvertVarLambdaParameters
diff --git a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java
index 19e277e2a5..53c3f27788 100644
--- a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java
+++ b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java
@@ -552,7 +552,6 @@ public void testExplicitParameterTypes() throws Exception {
                                       "}\n");
     }
 
-    //Todo: Verification is pending on nb-javac of JDK11
     @Test
     public void testImplicitVarParameterTypes1() throws Exception {
         HintTest.create()
@@ -560,7 +559,7 @@ public void testImplicitVarParameterTypes1() throws Exception {
                 .input("package test;\n" +
                        "import java.util.function.IntBinaryOperator;\n" +
                        "public class Test {\n" +
-                       "    public void main(String list) {\n" +
+                       "    public void main(String[] args) {\n" +
                        "        IntBinaryOperator calc3 = (int x, int y)^ ->  x + y;\n" +
                        "    }\n" +
                        "}\n")
@@ -572,13 +571,12 @@ public void testImplicitVarParameterTypes1() throws Exception {
                 .assertVerbatimOutput("package test;\n" +
                                       "import java.util.function.IntBinaryOperator;\n" +
                                       "public class Test {\n" +
-                                      "    public void main(List<String> list) {\n" +
+                                      "    public void main(String[] args) {\n" +
                                       "        IntBinaryOperator calc3 = (var x, var y) ->  x + y;\n" +
                                       "    }\n" +
                                       "}\n");
     }
 
-    //Todo: Verification is pending on nb-javac of JDK11
     @Test
     public void testImplicitVarParameterTypes2() throws Exception {
         HintTest.create()
@@ -586,24 +584,40 @@ public void testImplicitVarParameterTypes2() throws Exception {
                 .input("package test;\n" +
                        "import java.util.function.IntBinaryOperator;\n" +
                        "public class Test {\n" +
-                       "    public void main(String list) {\n" +
+                       "    public void main(String[] args) {\n" +
                        "        IntBinaryOperator calc3 = (x, y)^ ->  x + y;\n" +
                        "    }\n" +
                        "}\n")
                 .sourceLevel("1.11")
                 .run(Lambda.class)
-                .findWarning("4:48-4:48:verifier:ERR_ConvertVarLambdaParameters")
+                .findWarning("4:40-4:40:verifier:ERR_ConvertVarLambdaParameters")
                 .applyFix()
                 .assertCompilable()
                 .assertVerbatimOutput("package test;\n" +
                                       "import java.util.function.IntBinaryOperator;\n" +
                                       "public class Test {\n" +
-                                      "    public void main(List<String> list) {\n" +
+                                      "    public void main(String[] args) {\n" +
                                       "        IntBinaryOperator calc3 = (var x, var y) ->  x + y;\n" +
                                       "    }\n" +
                                       "}\n");
     }
 
+    @Test
+    public void testImplicitVarParameterTypes3() throws Exception {
+        HintTest.create()
+                .setCaretMarker('^')
+                .input("package test;\n" +
+                       "import java.util.function.IntBinaryOperator;\n" +
+                       "public class Test {\n" +
+                       "    public void main(String[] args) {\n" +
+                       "        IntBinaryOperator calc3 = (var x, var y)^ ->  x + y;\n" +
+                       "    }\n" +
+                       "}\n")
+                .sourceLevel("1.11")
+                .run(Lambda.class)
+                .assertNotContainsWarnings("ERR_ConvertVarLambdaParameters");
+    }
+
     static {
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists