Add missing test Java files

This commit is contained in:
Chris Smowton
2023-11-02 13:50:13 +00:00
parent 5b734fe937
commit e41da3b10a
2 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
public class GuardTest {
public static void sink(String s) { }
public static boolean isSafe(String s) { return s.length() < 10; }
public static void test(Object o) {
switch (o) {
case String s:
sink(s);
break;
default:
break;
}
switch (o) {
case String s when isSafe(s):
sink(s);
break;
default:
break;
}
}
}