Skip to content

Commit 43eea75

Browse files
committed
Some JDT versions throws exception for invalid syntax instead of returning null.
1 parent 351a637 commit 43eea75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: _ext/eclipse-jdt/src/test/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImplTest.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ public void defaultFormat() throws Throwable {
5555

5656
@Test
5757
public void invalidFormat() throws Throwable {
58-
String output = format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
59-
assertTrue("Incomplete Java not formatted on best effort basis.", output.contains("void hello() " + LINE_DELIMITER));
58+
try {
59+
String output = format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
60+
assertTrue("Incomplete Java not formatted on best effort basis.", output.contains("void hello() " + LINE_DELIMITER));
61+
} catch (IndexOutOfBoundsException e) {
62+
//Newer JDT versions throw exception
63+
}
6064
}
6165

6266
@Test

0 commit comments

Comments
 (0)