IntelliJ Platform Plugin SDK Help

7. Folding Test

This test verifies the Simple Language folding builder, implemented in the Folding Builder section of the Custom Language Support Tutorial, works as expected.

Define Test Data

Create a file in the testData directory. This java file contains markup instructions for three different cases of code folding.

public class Test { public static void main(String[] args)<fold text=' { '> { </fold>System.out.println("<fold text=''>simple:website</fold>");<fold text=' }'> }</fold> public static void main1(String[] args)<fold text=' { '> { </fold>System.out.println("<fold text='This is the value that could be looked up with the key \"key with spaces\".'>simple:key with spaces</fold>");<fold text=' }'> }</fold> public static void main2(String[] args)<fold text=' { '> { </fold>System.out.println("<fold text='Welcome to \n Wikipedia!'>simple:message</fold>");<fold text=' }'> }</fold> }

Define a Test

Add the testFolding() method to the SimpleCodeInsightTest class previously defined. This test method reuses the DefaultTestData.simple properties file.

public void testFolding() { myFixture.configureByFile("DefaultTestData.simple"); myFixture.testFolding(getTestDataPath() + "/"); }

Run the Test

Run the test and make sure it's green.

Last modified: 14 January 2021