Completion test exception

Answered

Started to make tests for my plugin. Trying to follow: http://www.jetbrains.org/intellij/sdk/docs/tutorials/writing_tests_for_plugins/completion_test.html

But getting an exception:

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: idea.plugin.psiviewer.controller.application.Configuration

at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$21.run(CodeInsightTestFixtureImpl.java:1220)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2372)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.setUp(CodeInsightTestFixtureImpl.java:1212)
at com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase.setUp(LightCodeInsightFixtureTestCase.java:100)
at completion.PerlCompletionTest.setUp(PerlCompletionTest.java:40)
at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:341)
at com.intellij.testFramework.UsefulTestCase$4.run(UsefulTestCase.java:428)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
at java.awt.EventQueue.access$400(EventQueue.java:81)
at java.awt.EventQueue$2.run(EventQueue.java:633)
at java.awt.EventQueue$2.run(EventQueue.java:631)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:362)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: idea.plugin.psiviewer.controller.application.Configuration
at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:222)
at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.handleInitComponentError(PlatformComponentManagerImpl.java:39)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.loadClasses(ComponentManagerImpl.java:441)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.loadClasses(ComponentManagerImpl.java:417)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.access$000(ComponentManagerImpl.java:403)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:108)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:87)
at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.load(ApplicationStoreImpl.java:101)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:499)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:481)
at com.intellij.idea.IdeaTestApplication$1.run(IdeaTestApplication.java:56)
at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
at com.intellij.openapi.application.WriteAction$1$1.run(WriteAction.java:47)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.intellij.openapi.application.WriteAction$1.run(WriteAction.java:44)
at com.intellij.openapi.application.WriteAction.execute(WriteAction.java:53)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:53)
at com.intellij.testFramework.LightPlatformTestCase.initApplication(LightPlatformTestCase.java:167)
at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:50)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$21.run(CodeInsightTestFixtureImpl.java:1216)
... 21 more
Caused by: java.lang.ClassNotFoundException: idea.plugin.psiviewer.controller.application.Configuration
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.loadClasses(ComponentManagerImpl.java:427)
... 38 more

ERROR: com.intellij.openapi.project.impl.ProjectManagerImpl has unsatisfied dependency: class com.intellij.ide.RecentProjectsManager among unsatisfiable dependencies: [[class com.intellij.openapi.vfs.VirtualFileManager, class com.intellij.ide.RecentProjectsManager, class com.intellij.openapi.progress.ProgressManager]] where com.intellij.util.pico.DefaultPicoContainer@499a12ee was the leaf container being asked for dependencies.
org.picocontainer.defaults.UnsatisfiableDependenciesException: com.intellij.openapi.project.impl.ProjectManagerImpl has unsatisfied dependency: class com.intellij.ide.RecentProjectsManager among unsatisfiable dependencies: [[class com.intellij.openapi.vfs.VirtualFileManager, class com.intellij.ide.RecentProjectsManager, class com.intellij.openapi.progress.ProgressManager]] where com.intellij.util.pico.DefaultPicoContainer@499a12ee was the leaf container being asked for dependencies.
at com.intellij.util.pico.ConstructorInjectionComponentAdapter.getGreediestSatisfiableConstructor(ConstructorInjectionComponentAdapter.java:113)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:210)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:550)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:610)
at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:245)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:211)
at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponentFromContainer(ComponentManagerImpl.java:168)
at com.intellij.openapi.application.impl.ApplicationImpl.getComponentFromContainer(ApplicationImpl.java:533)
at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:199)
at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:194)
at com.intellij.openapi.project.ex.ProjectManagerEx.getInstanceEx(ProjectManagerEx.java:33)
at com.intellij.openapi.application.impl.ApplicationImpl.disposeSelf(ApplicationImpl.java:294)
at com.intellij.openapi.application.impl.ApplicationImpl.access$400(ApplicationImpl.java:87)
at com.intellij.openapi.application.impl.ApplicationImpl$5$1.run(ApplicationImpl.java:283)
at com.intellij.openapi.util.ShutDownTracker$2.run(ShutDownTracker.java:171)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
at java.awt.EventQueue.access$400(EventQueue.java:81)
at java.awt.EventQueue$2.run(EventQueue.java:633)
at java.awt.EventQueue$2.run(EventQueue.java:631)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:734)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
ERROR: com.intellij.openapi.project.impl.ProjectManagerImpl has unsatisfied dependency: class com.intellij.ide.RecentProjectsManager among unsatisfiable dependencies: [[class com.intellij.openapi.vfs.VirtualFileManager, class com.intellij.ide.RecentProjectsManager, class com.intellij.openapi.progress.ProgressManager]] where com.intellij.util.pico.DefaultPicoContainer@499a12ee was the leaf container being asked for dependencies.
java.lang.AssertionError: com.intellij.openapi.project.impl.ProjectManagerImpl has unsatisfied dependency: class com.intellij.ide.RecentProjectsManager among unsatisfiable dependencies: [[class com.intellij.openapi.vfs.VirtualFileManager, class com.intellij.ide.RecentProjectsManager, class com.intellij.openapi.progress.ProgressManager]] where com.intellij.util.pico.DefaultPicoContainer@499a12ee was the leaf container being asked for dependencies.
at com.intellij.testFramework.LoggedErrorProcessor.processError(LoggedErrorProcessor.java:56)
at com.intellij.testFramework.TestLogger.error(TestLogger.java:67)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:134)
at com.intellij.ide.plugins.PluginManager.processException(PluginManager.java:134)
at com.intellij.ide.IdeEventQueue.processException(IdeEventQueue.java:403)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:737)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

2 comments
Comment actions Permalink
Official comment

Hi Alexandr,

 

I believe that the reason is in psi-viewer plugin which is located in idea-sandbox but is not part of tests classpath. To avoid this you can remove the plugin from sandbox or set custom plugins directory path for tests.

You can do the second via `idea.plugins.path` system property. It makes sense to set `-Didea.plugins.path=<custom_test_plugins_path>` as a parameters for default JUnit run configuration.

Also, I recommend you to customize `idea.config.path` and `idea.system.path` for tests as well. It helps you to avoid test failures because of changing settings in IDEA debug instance.

Comment actions Permalink

Works like a charm, thank you!

0

Please sign in to leave a comment.