void () { PsiFile file = myFixture.addFileToProject("Program.java", """ import java.io.InputStream; import java.util.HashMap; import java.util.Map; class Program { private static InputStream getFile(String name, Map<String, Object> args) { return Program.class.getResourceAsStream(name); } public static void main(String[] args) { // Ctrl + B or Ctrl + Left Mouse Button work correctly for following string: final String name = "file.sql"; // But it jumps only to folder in following case: final InputStream inputStream = getFile("dir/fil<caret>e.sql", new HashMap<String, Object>()); } }"""); PsiFile fileSql = myFixture.addFileToProject("dir/file.sql", "select 1;"); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); Editor editor = myFixture.getEditor(); EditorTestUtil.buildInitialFoldingsInBackground(editor); FoldingModelEx foldingModel = (FoldingModelEx)editor.getFoldingModel(); foldingModel.rebuild(); myFixture.doHighlighting(); PsiElement element = GotoDeclarationAction.findTargetElement(getProject(), editor, editor.getCaretModel().getOffset()); assertTrue("Should navigate to: file.sql instead of " + element, element != null && element.equals(fileSql)); }