String () { PsiFile file = myFixture.getFile(); List<PsiReference> referenceList = getReferencesInFile(file); Editor editor = myFixture.getEditor(); StringBuilder sb = new StringBuilder(); for (PsiReference reference : referenceList) { PsiElement targetElement = reference.resolve(); PsiElement sourceElement = reference.getElement(); TextRange referenceRange = reference.getRangeInElement(); String sourceElementText = sourceElement.getText(); int sourceElementOffset = sourceElement.getNode().getStartOffset(); ASTNode targetElementNode = targetElement.getNode(); sb .append("'") .append(referenceRange.subSequence(sourceElementText)) .append("'") .append(" at ") .append(editor.offsetToLogicalPosition(referenceRange.getStartOffset() + sourceElementOffset)) .append(" => ") .append('\n') .append(" ") .append(PsiUtilCore.getElementType(targetElementNode)) .append(" at ") .append(editor.offsetToLogicalPosition(targetElementNode.getStartOffset())) .append('\n') ; } return sb.toString(); }