jetbrains-ultimate/tst-211/com/goide/vgo/VgoTestUtil.java [67:123]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public static PsiFile setupVgoIntegration(@NotNull CodeInsightTestFixture fixture) {
    return setupVgoIntegration(null, DEFAULT_IMPORT_PATH, fixture, DEPENDENCIES);
  }

  public static PsiFile setupVgoIntegration(@Nullable String modulePath,
                                            @NotNull String importPath,
                                            @NotNull CodeInsightTestFixture fixture,
                                            @NotNull Map<String, VgoDependency> dependencies) {
    setupGopath(fixture, null);
    VgoModule module = createVgoModule(fixture, modulePath, importPath, dependencies);
    setupVgoIntegration(fixture, Collections.singletonList(module));
    return getGoModPsiFile(fixture, module);
  }

  @NotNull
  public static VirtualFile setupGopath(@NotNull CodeInsightTestFixture fixture, @Nullable String customGopath) {
    if (customGopath == null) {
      GoModuleLibrariesService.getInstance(fixture.getModule()).setLibraryRootUrls(VfsUtilCore.pathToUrl(GOPATH));
      return VfsTestUtil.findFileByCaseSensitivePath(GOPATH);
    }
    VirtualFile customGopathFile = VfsUtil.findFile(Paths.get(fixture.getTestDataPath(), customGopath), true);
    if (customGopathFile != null) {
      // Sometimes changes in custom gopath directory are not detected by tests, we explicitly refresh to overcome this.
      customGopathFile.refresh(false, true);
      GoModuleLibrariesService.getInstance(fixture.getModule()).setLibraryRootUrls(customGopathFile.getUrl());
      return customGopathFile;
    }
    throw new IllegalArgumentException("Cannot find custom gopath: " + customGopath);
  }

  @NotNull
  // made public
  public static VgoModule createVgoModule(@NotNull CodeInsightTestFixture fixture,
                                           @Nullable String modulePath,
                                           @NotNull String importPath,
                                           @NotNull Map<String, VgoDependency> dependencies) {
    String goModPath = modulePath != null ? FileUtil.join(modulePath, VgoUtil.GO_MOD) : VgoUtil.GO_MOD;
    PsiFile file = fixture.addFileToProject(goModPath, "module \"" + importPath + "\"");
    return new VgoModule(file.getVirtualFile().getParent(), importPath, dependencies);
  }

  public static void setupVgoIntegration(@NotNull CodeInsightTestFixture fixture, @NotNull List<VgoModule> modules) {
    VgoExcludeRootsPolicy.setPointersDisposable(fixture.getTestRootDisposable());
    // GoVendorExcludePolicy.setPointersDisposable(fixture.getTestRootDisposable());
    TestModeFlags.set(VgoIntegrationManager.DISABLE_TRACKERS, true, fixture.getTestRootDisposable());
    VgoProjectSettings.getInstance(fixture.getProject()).setIntegrationEnabled(true);
    setVgoModules(fixture, modules);
    Disposer.register(fixture.getTestRootDisposable(), () -> {
      VgoProjectSettings.getInstance(fixture.getProject()).setIntegrationEnabled(false);
      VgoModulesRegistry.getInstance(fixture.getProject()).updateAllModules(fixture.getModule(), Collections.emptySet());
      PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue();
    });
    PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue();
  }

  public static void setVgoModules(@NotNull CodeInsightTestFixture fixture, @NotNull List<VgoModule> modules) {
    for (VgoModule module : modules) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



jetbrains-ultimate/tst-213+/com/goide/vgo/VgoTestUtil.java [68:124]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static PsiFile setupVgoIntegration(@NotNull CodeInsightTestFixture fixture) {
        return setupVgoIntegration(null, DEFAULT_IMPORT_PATH, fixture, DEPENDENCIES);
    }

    public static PsiFile setupVgoIntegration(@Nullable String modulePath,
                                              @NotNull String importPath,
                                              @NotNull CodeInsightTestFixture fixture,
                                              @NotNull Map<String, VgoDependency> dependencies) {
        setupGopath(fixture, null);
        VgoModule module = createVgoModule(fixture, modulePath, importPath, dependencies);
        setupVgoIntegration(fixture, Collections.singletonList(module));
        return getGoModPsiFile(fixture, module);
    }

    @NotNull
    public static VirtualFile setupGopath(@NotNull CodeInsightTestFixture fixture, @Nullable String customGopath) {
        if (customGopath == null) {
            GoModuleLibrariesService.getInstance(fixture.getModule()).setLibraryRootUrls(VfsUtilCore.pathToUrl(GOPATH));
            return VfsTestUtil.findFileByCaseSensitivePath(GOPATH);
        }
        VirtualFile customGopathFile = VfsUtil.findFile(Paths.get(fixture.getTestDataPath(), customGopath), true);
        if (customGopathFile != null) {
            // Sometimes changes in custom gopath directory are not detected by tests, we explicitly refresh to overcome this.
            customGopathFile.refresh(false, true);
            GoModuleLibrariesService.getInstance(fixture.getModule()).setLibraryRootUrls(customGopathFile.getUrl());
            return customGopathFile;
        }
        throw new IllegalArgumentException("Cannot find custom gopath: " + customGopath);
    }

    @NotNull
    // made public
    public static VgoModule createVgoModule(@NotNull CodeInsightTestFixture fixture,
                                            @Nullable String modulePath,
                                            @NotNull String importPath,
                                            @NotNull Map<String, VgoDependency> dependencies) {
        String goModPath = modulePath != null ? FileUtil.join(modulePath, VgoUtil.GO_MOD) : VgoUtil.GO_MOD;
        PsiFile file = fixture.addFileToProject(goModPath, "module \"" + importPath + "\"");
        return new VgoModule(file.getVirtualFile().getParent(), importPath, dependencies);
    }

    public static void setupVgoIntegration(@NotNull CodeInsightTestFixture fixture, @NotNull List<VgoModule> modules) {
        VgoExcludeRootsPolicy.setPointersDisposable(fixture.getTestRootDisposable());
        // GoVendorExcludePolicy.setPointersDisposable(fixture.getTestRootDisposable());
        TestModeFlags.set(VgoIntegrationManager.DISABLE_TRACKERS, true, fixture.getTestRootDisposable());
        VgoProjectSettings.getInstance(fixture.getProject()).setIntegrationEnabled(true);
        setVgoModules(fixture, modules);
        Disposer.register(fixture.getTestRootDisposable(), () -> {
            VgoProjectSettings.getInstance(fixture.getProject()).setIntegrationEnabled(false);
            VgoModulesRegistry.getInstance(fixture.getProject()).updateAllModules(fixture.getModule(), Collections.emptySet());
            PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue();
        });
        PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue();
    }

    public static void setVgoModules(@NotNull CodeInsightTestFixture fixture, @NotNull List<VgoModule> modules) {
        for (VgoModule module : modules) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



