-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathJellyReferenceContributorTest.java
More file actions
39 lines (32 loc) · 1.09 KB
/
JellyReferenceContributorTest.java
File metadata and controls
39 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package io.jenkins.stapler.idea.jelly;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiReference;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
public class JellyReferenceContributorTest extends BasePlatformTestCase {
@Override
protected String getTestDataPath() {
return "src/test/testData";
}
public void testReferenceAtCaret() {
myFixture.configureByText(
"Foo.java",
"""
public class Foo {
public String getBar() {
return "";
}
}
""");
myFixture.configureByFiles("Foo/config.jelly");
PsiReference reference = myFixture.getReferenceAtCaretPosition();
assertNotNull(reference);
PsiElement resolved = reference.resolve();
assertNotNull(resolved);
if (resolved instanceof PsiMethod method) {
assertEquals("getBar", method.getName());
} else {
fail("not a method");
}
}
}