mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-18 07:15:51 +07:00
42 lines
1.4 KiB
Java
42 lines
1.4 KiB
Java
package com.intellij.codeInsight.intention;
|
|
|
|
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
|
|
import com.intellij.lang.java.JavaLanguage;
|
|
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
|
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
|
|
|
public class InvertIfConditionTest extends LightIntentionActionTestCase {
|
|
|
|
@Override
|
|
protected String getBasePath() {
|
|
return BASE_PATH;
|
|
}
|
|
|
|
private static final String BASE_PATH = "/codeInsight/invertIfCondition/";
|
|
private boolean myElseOnNewLine;
|
|
|
|
@Override
|
|
protected boolean shouldBeAvailableAfterExecution() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
protected void beforeActionStarted(final String testName, final String contents) {
|
|
super.beforeActionStarted(testName, contents);
|
|
final CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
|
|
myElseOnNewLine = settings.ELSE_ON_NEW_LINE;
|
|
settings.ELSE_ON_NEW_LINE = !contents.contains("else on the same line");
|
|
}
|
|
|
|
@Override
|
|
protected void afterActionCompleted(final String testName, final String contents) {
|
|
super.afterActionCompleted(testName, contents);
|
|
CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
|
|
settings.ELSE_ON_NEW_LINE = myElseOnNewLine;
|
|
}
|
|
|
|
public void test() throws Exception {
|
|
doAllTests();
|
|
}
|
|
}
|