changeset 55914:41a3f9bba1ab switch2

Cleanup - fixing test.
author jlahoda
date Fri, 03 May 2019 15:07:12 +0200
parents ebdc3fee7ceb
children 8bf40c8fade0
files test/langtools/tools/javac/switchextra/DefiniteAssignment1.java
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/langtools/tools/javac/switchextra/DefiniteAssignment1.java	Thu May 02 11:19:27 2019 +0200
+++ b/test/langtools/tools/javac/switchextra/DefiniteAssignment1.java	Fri May 03 15:07:12 2019 +0200
@@ -84,14 +84,17 @@
         {
         int x;
 
-        switch(a) {
-            case 1: x = 1; break;
-            case 0:
-            default: throw new IllegalStateException();
-        }
+        try {
+            switch(a) {
+                case 1: x = 1; break;
+                case 0:
+                default: throw new UnsupportedOperationException();
+            }
 
-        if (x != 0)
-            throw new IllegalStateException("Unexpected value.");
+            throw new IllegalStateException("Unexpected value: " + x);
+            } catch (UnsupportedOperationException ex) {
+                //OK
+            }
         }
 
         {