mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
introduce constant: create subclass when it is not possible to place the constant inside the class (IDEA-86965)
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
enum TestEnum {
|
||||
ONE("te<caret>stString");
|
||||
|
||||
TestEnum(String str) {
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
enum TestEnum {
|
||||
ONE(Constants.xxx);
|
||||
|
||||
TestEnum(String str) {
|
||||
}
|
||||
|
||||
private class Constants {
|
||||
public static final String xxx = "testString";
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,12 @@ public class IntroduceConstantTest extends LightCodeInsightTestCase {
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testFromEnumConstantInitializer() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
new MockIntroduceConstantHandler(null).invoke(getProject(), getEditor(), getFile(), null);
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testEnumConstant() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user