[Java. Code Formatting] Add tests for blank lines with rearrangement

IDEA-110857

GitOrigin-RevId: f21d7c0a9decf830d76c5a25085f4f77448971a8
This commit is contained in:
Georgii Ustinov
2024-07-04 19:56:49 +00:00
committed by intellij-monorepo-bot
parent 37c6900424
commit a01e2c2c9f
3 changed files with 39 additions and 0 deletions
@@ -0,0 +1,11 @@
package org.example;
import org.jetbrains.annotations.NotNull;
public class ClassWithAnnotations {
private static final Boolean SIMPLE_FIELD = false;
@NotNull public static final Boolean ANOTHER_ANNOTATED_FIELD = false;
@NotNull public static final Boolean ANNOTATED_FIELD = false;
private @NotNull Boolean annotatedField = false;
public Boolean simpleField = false;
}
@@ -0,0 +1,20 @@
package org.example;
import org.jetbrains.annotations.NotNull;
public class ClassWithAnnotations {
private static final Boolean SIMPLE_FIELD = false;
@NotNull
public static final Boolean ANOTHER_ANNOTATED_FIELD = false;
@NotNull
public static final Boolean ANNOTATED_FIELD = false;
private @NotNull Boolean annotatedField = false;
public Boolean simpleField = false;
}
@@ -26,4 +26,12 @@ class JavaFormatterBlankLinesAroundFieldTest : JavaFormatterTestCase() {
getSettings(JavaLanguage.INSTANCE).BLANK_LINES_AROUND_FIELD = 1
doTest()
}
fun testRearrangement() {
getSettings(JavaLanguage.INSTANCE).BLANK_LINES_AROUND_FIELD = 1
val testName = getTestName(true)
val afterFileName = "${testName}_after"
doTest(testName, afterFileName)
doTest(afterFileName, afterFileName)
}
}