In this test we will check if references, implemented in the Reference Contributor section of the Custom Language Support Tutorial, works as we expect.

10.1. Define test data

Create a file ReferenceTestData.java.

public class Test {
    public static void main(String[] args) {
        System.out.println("simple:website<caret>");
    }
}

10.2. Define a test method

public void testReference() {
    myFixture.configureByFiles("ReferenceTestData.java", "DefaultTestData.simple");
    PsiElement element = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent();
    assertEquals("http://en.wikipedia.org/", ((SimpleProperty) element.getReferences()[0].resolve()).getValue());
}

10.3. Run the test

Run the test and make sure it's green.


Previous Top

results matching ""

    No results matching ""