void () { final PsiFile file = myFixture.addFileToProject("Foo.java", "public class Foo {" + " public enum E {;}" + " void foo() {" + " for (E e : E.va<caret>lues()){}" + " }" + "}"); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); final PsiElement element = TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); assertNotNull(element); assertInstanceOf(element, PsiMethod.class); assertTrue(((Navigatable)element).canNavigate()); ((Navigatable)element).navigate(true); assertEquals(32, myFixture.getCaretOffset()); }