private static @NotNull <E extends PsiElement> SmartPointerElementInfo createElementInfo(@NotNull SmartPointerManagerImpl manager,
                                                                                           @NotNull E element,
                                                                                           @Nullable PsiFile containingFile,
                                                                                           boolean forInjected) {
    SmartPointerElementInfo elementInfo = doCreateElementInfo(manager.getProject(), element, containingFile, forInjected);
    if (ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManagerEx.isInStressTest()) {
      PsiElement restoredElement = elementInfo.restoreElement(manager);
      if (restoredElement == null) {
        // The problem might be with injection. It's a questionable solution, requires more discussion.
        elementInfo = doCreateElementInfo(manager.getProject(), element, containingFile, !forInjected);
        restoredElement = elementInfo.restoreElement(manager);
      }
      if (!element.equals(restoredElement)) {
        // likely cause: PSI having isPhysical==true, but which can't be restored by containing file and range. To fix, make isPhysical return false
        LOG.error("Cannot restore " + element + " of " + element.getClass() + " from " + elementInfo +
                  "; restored=" + restoredElement + (restoredElement == null ? "" : " of " + restoredElement.getClass()) + " in " + element.getProject());
      }
    }
    return elementInfo;
  }
private static @NotNull <E extends PsiElement> SmartPointerElementInfo createElementInfo(@NotNull SmartPointerManagerImpl manager,
                                                                                           @NotNull E element,
                                                                                           @Nullable PsiFile containingFile,
                                                                                           boolean forInjected)