void (CodeInsightTestFixture fixture, @NotNull String schemaText, @NotNull String schemaExt, Predicate<VirtualFile> predicate) { String path = "json_schema_test/schema." + schemaExt; VirtualFile tempFile = fixture.findFileInTempDir(path); if (tempFile != null) return; PsiFile file = fixture.addFileToProject(path, schemaText); JsonSchemaTestServiceImpl.setProvider(new JsonSchemaTestProvider(file.getVirtualFile(), predicate)); Disposable testRootDisposable = fixture.getTestRootDisposable(); Disposer.register(testRootDisposable, () -> JsonSchemaTestServiceImpl.setProvider(null)); Project project = fixture.getProject(); ServiceContainerUtil.replaceService(project, JsonSchemaService.class, new JsonSchemaTestServiceImpl(project), testRootDisposable); }