Skip to content

Commit

Permalink
Fixing JDT tests. Tests not passing since #480.
Browse files Browse the repository at this point in the history
  • Loading branch information
fvgh committed Jan 31, 2020
1 parent 67609c3 commit cd9b77e
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -61,9 +61,16 @@ public void defaultFormat() throws Throwable {
* Spotless anyhow provides possibilities to change exception behavior.
* Furthermore it is assumed that Spotless runs on compile-able code.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void invalidFormat() throws Throwable {
format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
try {
String output = format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
assertTrue("Incomplete Java not formatted on best effort basis.", output.contains("void hello() " + LINE_DELIMITER));
} catch (IndexOutOfBoundsException e) {
/*
* Some JDT versions throw exception, but this changed again in later versions.
* Anyhow, exceptions are acceptable, since Spotless should fromat valid Java code.
*/
}
}

@Test
Expand Down

0 comments on commit cd9b77e

Please sign in to comment.