mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambdafication
This commit is contained in:
@@ -7,7 +7,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.formatter.FormatterTestCase;
|
||||
import com.intellij.testFramework.IdeaTestCase;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.TestLoggerFactory;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
@@ -23,7 +22,6 @@ public class JsonFormattingTest extends FormatterTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
IdeaTestCase.initPlatformPrefix();
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@@ -61,12 +59,9 @@ public class JsonFormattingTest extends FormatterTestCase {
|
||||
}
|
||||
|
||||
public void testWrapping() throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
getSettings().setRightMargin(JsonLanguage.INSTANCE, 20);
|
||||
doTest();
|
||||
}
|
||||
withPreservedSettings(() -> {
|
||||
getSettings().setRightMargin(JsonLanguage.INSTANCE, 20);
|
||||
doTest();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,68 +76,48 @@ public class JsonFormattingTest extends FormatterTestCase {
|
||||
}
|
||||
|
||||
private void checkPropertyAlignment(@NotNull final PropertyAlignment alignmentType) throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
getCustomSettings().PROPERTY_ALIGNMENT = alignmentType.getId();
|
||||
doTest();
|
||||
}
|
||||
withPreservedSettings(() -> {
|
||||
getCustomSettings().PROPERTY_ALIGNMENT = alignmentType.getId();
|
||||
doTest();
|
||||
});
|
||||
}
|
||||
|
||||
public void testChopDownArrays() throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
getCustomSettings().ARRAY_WRAPPING = WrapType.CHOP_DOWN_IF_LONG.getLegacyRepresentation();
|
||||
getSettings().setRightMargin(JsonLanguage.INSTANCE, 40);
|
||||
doTest();
|
||||
}
|
||||
withPreservedSettings(() -> {
|
||||
getCustomSettings().ARRAY_WRAPPING = WrapType.CHOP_DOWN_IF_LONG.getLegacyRepresentation();
|
||||
getSettings().setRightMargin(JsonLanguage.INSTANCE, 40);
|
||||
doTest();
|
||||
});
|
||||
}
|
||||
|
||||
// IDEA-138902
|
||||
public void testObjectsWithSingleProperty() throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
});
|
||||
withPreservedSettings(this::doTest);
|
||||
}
|
||||
|
||||
// Moved from JavaScript
|
||||
|
||||
public void testWeb3830() throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
CommonCodeStyleSettings.IndentOptions options = getIndentOptions();
|
||||
options.INDENT_SIZE = 8;
|
||||
options.USE_TAB_CHARACTER = true;
|
||||
options.TAB_SIZE = 8;
|
||||
doTest();
|
||||
}
|
||||
withPreservedSettings(() -> {
|
||||
CommonCodeStyleSettings.IndentOptions options = getIndentOptions();
|
||||
options.INDENT_SIZE = 8;
|
||||
options.USE_TAB_CHARACTER = true;
|
||||
options.TAB_SIZE = 8;
|
||||
doTest();
|
||||
});
|
||||
}
|
||||
|
||||
public void testReformatJSon() throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
getIndentOptions().INDENT_SIZE = 4;
|
||||
doTest();
|
||||
}
|
||||
withPreservedSettings(() -> {
|
||||
getIndentOptions().INDENT_SIZE = 4;
|
||||
doTest();
|
||||
});
|
||||
}
|
||||
|
||||
public void testReformatJSon2() throws Exception {
|
||||
withPreservedSettings(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
getIndentOptions().INDENT_SIZE = 4;
|
||||
doTest();
|
||||
}
|
||||
withPreservedSettings(() -> {
|
||||
getIndentOptions().INDENT_SIZE = 4;
|
||||
doTest();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.lang.LanguageStructureViewBuilder;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
|
||||
import static com.intellij.testFramework.PlatformTestUtil.assertTreeEqual;
|
||||
@@ -21,12 +20,7 @@ public class JsonStructureViewTest extends JsonTestCase {
|
||||
|
||||
private void doTest(final String expected) {
|
||||
myFixture.configureByFile("structureView/" + getTestName(false) + ".json");
|
||||
myFixture.testStructureView(new Consumer<StructureViewComponent>() {
|
||||
@Override
|
||||
public void consume(StructureViewComponent component) {
|
||||
assertTreeEqual(component.getTree(), expected);
|
||||
}
|
||||
});
|
||||
myFixture.testStructureView(component -> assertTreeEqual(component.getTree(), expected));
|
||||
}
|
||||
|
||||
public void testPropertyOrderPreserved() {
|
||||
|
||||
Reference in New Issue
Block a user