mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AlphaUnsortedPropertiesFilesInspection: added test for fix with multiline property
This commit is contained in:
+25
-16
@@ -15,29 +15,20 @@
|
||||
*/
|
||||
package com.intellij.lang.properties;
|
||||
|
||||
import com.intellij.ExtensionPoints;
|
||||
import com.intellij.codeInspection.duplicatePropertyInspection.DuplicatePropertyInspection;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.unsorted.AlphaUnsortedPropertiesFileInspection;
|
||||
import com.intellij.codeInspection.unsorted.AlphaUnsortedPropertiesFileInspectionSuppressor;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
* @author Dmitry Batkovich
|
||||
*/
|
||||
public class AlphaUnsortedInspectionTest extends InspectionTestCase {
|
||||
private AlphaUnsortedPropertiesFileInspection myTool;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myTool = new AlphaUnsortedPropertiesFileInspection();
|
||||
}
|
||||
|
||||
public class AlphaUnsortedInspectionTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
public void testUnsorted() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
@@ -63,14 +54,32 @@ public class AlphaUnsortedInspectionTest extends InspectionTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testFix() {
|
||||
myFixture.configureByText("p.properties", "a=\n" +
|
||||
"c=\n" +
|
||||
"b=\\r\\n\\\n" +
|
||||
"f");
|
||||
myFixture.enableInspections(new AlphaUnsortedPropertiesFileInspection());
|
||||
final IntentionAction intention = myFixture.getAvailableIntention("Sort resource bundle files", "p.properties");
|
||||
assertNotNull(intention);
|
||||
myFixture.launchAction(intention);
|
||||
myFixture.checkResult("a=\n" +
|
||||
"b=\\r\\n\\\n" +
|
||||
"f\n" +
|
||||
"c=");
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest("alphaUnsorted/" + getTestName(true), myTool);
|
||||
myFixture.testInspection(getTestName(true), new LocalInspectionToolWrapper(new AlphaUnsortedPropertiesFileInspection()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("properties") + "/testData";
|
||||
return PluginPathManager.getPluginHomePath("properties") + "/testData/alphaUnsorted/";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWriteActionRequired() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user