Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.37 KB

File metadata and controls

33 lines (25 loc) · 1.37 KB
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.

8.1. Define the Test Data

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 %}

8.2. Define a Test Method

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());
  }

8.3. Run the Test

Run the test and make sure it's green.