Creating project in IdeaTestCase


I am extending IdeaTestCase but I am not using bundled project and module since I want fine grained control over the project created. There is problem in the tear down phase of the testcase where probably my project is not getting torn down properly and is leaking listeners.

Partial stacktrace

junit.framework.AssertionFailedError: Listeners leaked for interface com.intellij.openapi.editor.event.CaretListener:
     at com.intellij.testFramework.PlatformTestCase.tearDown(
     at com.intellij.testFramework.IdeaTestCase.tearDown(


I would like to know

1. Is there a way to properly dispose of my project (I have a project instance in the test)?
2. Is there a way to have more fine grained control over project creation using IdeaTestCase or a similar class

Also, this was working for IJ 11 so it has something to do with IJ 12. I am using Idea Community Edition - IdeaIC 129.354


1 comment
Comment actions Permalink

Hi Siddharth,

You can override PlatformTestCase.setUpProject() to get control which is as fine-grained as you like - there's no need to create a second project in the same test. This will also ensure that the project is correctly duisposed.


Please sign in to leave a comment.