void () { myFixture.addClass(""" package demo; public class User {} """); myFixture.configureByText("Demo.java", """ public class Demo { public void run() { String x = /* language=jvm-class-name */ "demo.U<caret>ser"; } } """); JavaClassReference reference = findReferenceOfClass(myFixture.getReferenceAtCaretPosition(), JavaClassReference.class); assertNotNull("there must be a JavaClassReference", reference); assertEquals("User", reference.getCanonicalText()); PsiElement resolved = reference.resolve(); assertTrue("references resolves to PsiClass", resolved instanceof PsiClass); }