void () { PsiElement element = GotoDeclarationAction.findTargetElement(getProject(), getEditor(), getEditor().getCaretModel().getOffset()); assertEquals(getFile(), element.getContainingFile()); getEditor().getCaretModel().moveToOffset(element.getTextOffset()); getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER); getEditor().getSelectionModel().removeSelection(); }