3. Completion Test
This test checks if the Simple Language code completion functionality, implemented in the Reference Contributor section of the Custom Language Support Tutorial, works as expected.
Define Test Data
DefaultTestData.simple properties file in the
Create a test input Java file
CompleteTestData.java in the
testData directory. This file contains a Simple Language snippet within the Java.
Define a Test
LightJavaCodeInsightFixtureTestCase to create
getTestDataPath(), and return the path from the root of this plugin module to the
At this point only one test is defined in
testCompletion(). This method:
Configures the test using the two input files.
Calls the basic completion functionality. Behind the scenes, this method call creates a list of possible elements to complete the embedded Simple Language reference.
Checks the list of possible element names to ensure it contains all Simple Language completion possibilities.
Run the Test
Run the test by:
Opening the Gradle Tool Window.
simple_language_plugin. You may need to reimport it as a Gradle project.
Drill down under
simple_language_pluginto Tasks, verification, test task.
Run the test task.
The results are displayed in the Run Tool Window, and also written to the
If the Run Tool Window displays the error Test events were not received, do the following:
In the Gradle Tool Window, drill down under
simple_language_pluginto Tasks, build, clean task.
Run the clean task, which deletes the
Retry the test.