diff --git a/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java b/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java index 3e4e175e6..ef6bef087 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java @@ -144,6 +144,19 @@ public void format() { } } + @Test + public void idempotent() { + try { + Formatter formatter = new Formatter(); + String formatted = formatter.formatSource(input); + formatted = StringWrapper.wrap(formatted, formatter); + String reformatted = formatter.formatSource(formatted); + assertEquals("bad output for " + name, formatted, reformatted); + } catch (FormatterException e) { + fail(String.format("Formatter crashed on %s: %s", name, e.getMessage())); + } + } + @Test public void idempotentLF() { try {