From 880eef5aaceaa656f69fa6a5a1d101a563d025f3 Mon Sep 17 00:00:00 2001 From: Louis Vignier Date: Fri, 3 Dec 2021 21:55:15 +0100 Subject: [PATCH] IJ-CR-18127 [java] Test naming conventions disabled state GitOrigin-RevId: 7fe6b1b04ba59f71b4fc2f50413e8806a98325ff --- .../ex/InspectionProfileTest.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java index af4e28677633..6f9d3aa662b3 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java @@ -21,6 +21,7 @@ import com.intellij.psi.search.scope.packageSet.NamedScope; import com.intellij.testFramework.InspectionsKt; import com.intellij.testFramework.LightIdeaTestCase; import com.intellij.util.SmartList; +import com.siyeh.ig.junit.TestClassNamingConvention; import com.siyeh.ig.naming.ClassNamingConvention; import com.siyeh.ig.naming.FieldNamingConventionInspection; import com.siyeh.ig.naming.NewClassNamingConventionInspection; @@ -630,13 +631,32 @@ public class InspectionProfileTest extends LightIdeaTestCase { assertThat(importedProfile.writeScheme()).isEqualTo(mergedElement); } + public void testDisabledNamingConvention() throws Exception { + InspectionProfileImpl profile = createEmptyProfile(); + @Language("XML") String customSettingsText = "\n" + + " "; + + readFromXml(profile, customSettingsText); + assertEquals(customSettingsText, serialize(profile)); + + InspectionToolWrapper wrapper = profile.getInspectionTool("NewClassNamingConvention", getProject()); + assertNotNull(wrapper); + NewClassNamingConventionInspection tool = (NewClassNamingConventionInspection)wrapper.getTool(); + assertTrue(new TestClassNamingConvention().isEnabledByDefault()); + assertFalse(tool.isConventionEnabled("JUnitTestClassNamingConvention")); + } + public void testStoredMemberVisibility() throws Exception { InspectionProfileImpl profile = createProfile(new InspectionProfileImpl("foo")); profile.readExternal(JDOMUtil.load("\n" + - " \n" + - "