Creating project in IdeaTestCase

Hello,

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:
[com.intellij.codeInsight.daemon.impl.DaemonListeners$2@a48480]
     at com.intellij.testFramework.PlatformTestCase.tearDown(PlatformTestCase.java:394)
     at com.intellij.testFramework.IdeaTestCase.tearDown(IdeaTestCase.java:46)

...

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

thanks
Siddharth

1 comment

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.

0

Please sign in to leave a comment.