|
7 | 7 | */ |
8 | 8 | package com.intellij.lang.jsgraphql.formatter; |
9 | 9 |
|
| 10 | +import com.intellij.lang.jsgraphql.GraphQLTestCaseBase; |
10 | 11 | import com.intellij.openapi.command.WriteCommandAction; |
11 | 12 | import com.intellij.psi.codeStyle.CodeStyleManager; |
12 | | -import com.intellij.psi.codeStyle.CodeStyleSettingsManager; |
13 | | -import com.intellij.testFramework.fixtures.BasePlatformTestCase; |
14 | | -import org.junit.internal.runners.JUnit38ClassRunner; |
15 | | -import org.junit.runner.RunWith; |
16 | 13 |
|
17 | | -@RunWith(JUnit38ClassRunner.class) // TODO: drop the annotation when issue with Gradle test scanning go away |
18 | | -public class GraphQLFormatterTest extends BasePlatformTestCase { |
| 14 | +public class GraphQLFormatterTest extends GraphQLTestCaseBase { |
19 | 15 |
|
20 | 16 | @Override |
21 | | - protected String getTestDataPath() { |
22 | | - return "test-resources/testData/graphql"; |
| 17 | + protected String getBasePath() { |
| 18 | + return "/formatter"; |
23 | 19 | } |
24 | 20 |
|
25 | 21 | public void testFormatter() { |
26 | | - myFixture.configureByFiles("FormatterTestData.graphql"); |
27 | | - CodeStyleSettingsManager.getSettings(getProject()).KEEP_BLANK_LINES_IN_CODE = 2; |
28 | | - new WriteCommandAction.Simple(getProject()) { |
29 | | - @Override |
30 | | - protected void run() throws Throwable { |
31 | | - CodeStyleManager.getInstance(getProject()).reformat(myFixture.getFile()); |
32 | | - } |
33 | | - }.execute(); |
34 | | - myFixture.checkResultByFile("FormatterExpectedResult.graphql"); |
| 22 | + doTest(); |
| 23 | + } |
| 24 | + |
| 25 | + private void doTest() { |
| 26 | + myFixture.configureByFiles(getTestName(false) + ".graphql"); |
| 27 | + WriteCommandAction.runWriteCommandAction(getProject(), () -> { |
| 28 | + CodeStyleManager.getInstance(getProject()).reformat(myFixture.getFile()); |
| 29 | + }); |
| 30 | + myFixture.checkResultByFile(getTestName(false) + "_after.graphql"); |
35 | 31 | } |
36 | 32 |
|
37 | 33 | } |
0 commit comments