Skip to content

Commit

Permalink
Add failing FallThrough test case
Browse files Browse the repository at this point in the history
Issue: #229
  • Loading branch information
knutwannheden committed Dec 18, 2023
1 parent 41f907d commit 1a65c15
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test/java/org/openrewrite/staticanalysis/FallThroughTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.openrewrite.staticanalysis;

import org.junit.jupiter.api.Test;
import org.junitpioneer.jupiter.ExpectedToFail;
import org.openrewrite.DocumentExample;
import org.openrewrite.Issue;
import org.openrewrite.Tree;
Expand Down Expand Up @@ -269,6 +270,42 @@ public void oneCase(int i) {
);
}

@Test
@Issue("https://github.com/openrewrite/rewrite-static-analysis/issues/229")
@ExpectedToFail
void switchAsLastStatement() {
rewriteRun(
//language=java
java(
"""
public class A {
public int m(int i) {
switch (i) {
case 0:
if (true) return i;
default:
throw new IllegalStateException();
}
}
}
""",
"""
public class A {
public int m(int i) {
switch (i) {
case 0:
if (true) return i;
// fall through
default:
throw new IllegalStateException();
}
}
}
"""
)
);
}

@Test
void nestedBlocks() {
rewriteRun(
Expand Down

0 comments on commit 1a65c15

Please sign in to comment.