[Java. Code Formatting] Fix failing tests due to the new way of formatting javadocs

IDEA-361836

GitOrigin-RevId: 02ccd10c950cf8d4b7f2dded18e15c76ed3c86c9
This commit is contained in:
Georgii Ustinov
2025-03-06 10:04:24 +02:00
committed by intellij-monorepo-bot
parent 3107ed3c88
commit 34eb50671e
5 changed files with 38 additions and 9 deletions

View File

@@ -3,9 +3,17 @@ package com.intellij.java.codeInsight.editorActions;
import com.intellij.codeInsight.editorActions.FixDocCommentAction;
import com.intellij.openapi.editor.impl.AbstractEditorTest;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
public class FixDocCommentTest extends AbstractEditorTest {
@Override
protected void setUp() throws Exception {
super.setUp();
JavaCodeStyleSettings settings = getCustomSettings(JavaCodeStyleSettings.class);
settings.JD_KEEP_EMPTY_LINES = false;
}
public void testGenerateMethodDoc() {
String initial = """
class Test {

View File

@@ -16,8 +16,16 @@
package com.intellij.java.codeInsight.intention;
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
public class AddJavadocIntentionTest extends LightIntentionActionTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
JavaCodeStyleSettings settings = getCustomSettings(JavaCodeStyleSettings.class);
settings.JD_KEEP_EMPTY_LINES = false;
}
@Override
protected String getBasePath() {
return "/codeInsight/addJavadoc";

View File

@@ -662,6 +662,7 @@ class Test {
fun testDocComment2() {
settings.KEEP_SIMPLE_METHODS_IN_ONE_LINE = true
javaSettings.JD_KEEP_EMPTY_LINES = false
doTextTest("class Test {\n" +
"/**\n" +
"*\n" +

View File

@@ -19,9 +19,19 @@ import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
public class ChangeSignatureTest extends ChangeSignatureBaseTest {
private CommonCodeStyleSettings getJavaSettings() {
private CommonCodeStyleSettings getCommonSettings() {
return getCurrentCodeStyleSettings().getCommonSettings(JavaLanguage.INSTANCE);
}
private JavaCodeStyleSettings getJavaSettings() {
return getCurrentCodeStyleSettings().getCustomSettings(JavaCodeStyleSettings.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
getJavaSettings().JD_KEEP_EMPTY_LINES = false;
}
public void testSimple() {
doTest(null, null, null, new ParameterInfoImpl[0], new ThrownExceptionInfo[0], false);
@@ -434,20 +444,20 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
}
public void testMethodParametersAlignmentAfterMethodNameChange() {
getJavaSettings().ALIGN_MULTILINE_PARAMETERS = true;
getJavaSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
doTest(null, "test123asd", null, new SimpleParameterGen(), new SimpleExceptionsGen(), false);
}
public void testMethodParametersAlignmentAfterMethodVisibilityChange() {
getJavaSettings().ALIGN_MULTILINE_PARAMETERS = true;
getJavaSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
doTest(PsiModifier.PROTECTED, null, null, new SimpleParameterGen(), new SimpleExceptionsGen(), false);
}
public void testMethodParametersAlignmentAfterMethodReturnTypeChange() {
getJavaSettings().ALIGN_MULTILINE_PARAMETERS = true;
getJavaSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
doTest(null, null, "Exception", new SimpleParameterGen(), new SimpleExceptionsGen(), false);
}
@@ -847,8 +857,8 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
}
public void testMethodParametersAlignmentAfterMethodReturnTypeChangeMarkdown() {
getJavaSettings().ALIGN_MULTILINE_PARAMETERS = true;
getJavaSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS = true;
getCommonSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
doTest(null, null, "Exception", new SimpleParameterGen(), new SimpleExceptionsGen(), false);
}

View File

@@ -4,6 +4,7 @@ package com.intellij.structuralsearch;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
import org.jetbrains.annotations.NotNull;
@@ -1535,6 +1536,7 @@ public class StructuralReplaceTest extends StructuralReplaceTestCase {
public void testClassReplacement9() throws IOException {
String s1 = loadFile("before1.java");
getCurrentCodeStyleSettings().getCustomSettings(JavaCodeStyleSettings.class).JD_KEEP_EMPTY_LINES = false;
String s2 = """
class 'A extends '_TestCaseCass:[regex( .*TestCase ) ] {
'_OtherStatement*;