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 2019/06/25 12:15:14 UTC

[GitHub] [netbeans] arusinha commented on a change in pull request #1323: [NETBEANS-2475]:Fixed Convert Switch to Switch-Expression hint for default case without break

arusinha commented on a change in pull request #1323: [NETBEANS-2475]:Fixed Convert Switch to Switch-Expression hint for default case without break
URL: https://github.com/apache/netbeans/pull/1323#discussion_r297154971
 
 

 ##########
 File path: java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java
 ##########
 @@ -525,7 +525,65 @@ public void testSwitch2SwitchExpressionMultiCase() throws Exception {
                               "     }\n" +
                               "}\n");
     }
-
+     public void testSwitch2SwitchExpressionMultiCase2() throws Exception {
+        HintTest.create()
+                .input("package test;" +
+                       "public class Test {\n" +
+                       "     private void test(int p) {\n" +
+                       "         String result;\n" +
+                       "         switch (p) {\n" +
+                       "             case 1:\n" +
+                       "             case 2: result = \"2\"; break;\n" +
+                       "             case 3: result = \"3\"; break;\n" +
+                       "             default: result = \"default\";\n" +
+                       "         }\n" +
+                       "     }\n" +
+                       "}\n")
+                .sourceLevel(SourceVersion.latest().name())
+                .options("--enable-preview")
+                .run(ConvertSwitchToRuleSwitch.class)
+                .findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
+                .applyFix()
+                .assertCompilable()
+                .assertOutput("package test;" +
+                              "public class Test {\n" +
+                              "     private void test(int p) {\n" +
+                              "         String result;\n" +
+                              "         result = switch (p) {\n" +
+                              "             case 1, 2 -> \"2\";\n" +
+                              "             case 3 -> \"3\";\n" +
+                              "             default -> \"default\";\n" +
+                              "         };\n" +
+                              "     }\n" +
+                              "}\n");
+    }
+public void testSwitch2SwitchExpressionOnlyDefault() throws Exception {
 
 Review comment:
   had corrected the same in recent commit.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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