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.
7.1. Define Test Data
Create a file FoldingTestData.java
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='http://en.wikipedia.org/'>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>
}
7.2. 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() + "/FoldingTestData.java");
}
7.3. Run the Test
Run the test and make sure it’s green.
Last modified: 19 February 2020