[java] TooFewBranchesForSwitch - add test case from comment on #5311

This commit is contained in:
Andreas Dangel 2024-11-07 19:50:29 +01:00
parent 16eafc89c2
commit ee7d6fed3e
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3

View File

@ -178,6 +178,26 @@ class Tester {
return result;
}
}
]]></code>
</test-code>
<test-code>
<description>From #5311: Another example for list of case constants</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Foo {
String foo(Bar bar) {
return switch (bar) {
case A, B, C, D -> "Hello";
case E, F, G -> "World";
};
}
enum Bar {
A, B, C, D, E, F, G
}
}
]]></code>
</test-code>
</test-data>