SwitchBackwardMigrationInspection: add test for throwing exception in branch

This commit is contained in:
Roman.Ivanov
2019-01-09 15:47:56 +07:00
parent 6be075db29
commit 45afa7feb5
2 changed files with 26 additions and 0 deletions
@@ -0,0 +1,15 @@
// "Replace with old style 'switch' statement" "true"
import java.util.*;
public class GenerateThrow {
void foo(int i) {
int res;
switch (i) {
case 0:
res = 1;
break;
default:
throw new IllegalArgumentException();
}
}
}
@@ -0,0 +1,11 @@
// "Replace with old style 'switch' statement" "true"
import java.util.*;
public class GenerateThrow {
void foo(int i) {
int res = <caret>switch (i) {
case 0 -> 1;
default -> throw new IllegalArgumentException();
};
}
}