title |
---|
8. Find Usages Test |
This test ensures the find usages provider, implemented in the Find Usages Provider section of the Custom Language Support Tutorial, works correctly.
Create the FindUsagesTestData.simple
properties file in the testData
directory.
{% include /code_samples/simple_language_plugin/src/test/testData/FindUsagesTestData.simple %}
Create the test file FindUsagesTestData.java
, which contains one embedded Simple Language prefix and key.
{% include /code_samples/simple_language_plugin/src/test/testData/FindUsagesTestData.java %}
Add the testFindUsages()
method to the SimpleCodeInsightTest
class previously defined.
This test verifies the find usage functionality will identify the "key with spaces".
public void testFindUsages() {
Collection<UsageInfo> usageInfos = myFixture.testFindUsages("FindUsagesTestData.simple", "FindUsagesTestData.java");
assertEquals(1, usageInfos.size());
}
Run the test and make sure it's green.