Add jar library to plugin unit test.


I'm developing an Idea plugin, which analisis if java class has an annotation @Right. This annotation is in jar-file named access.jar. In java runtime enviroment everething is great and simple. THe problem is in an Unit test for that plugin (Unit test extends LightCodeInsightFixtureTestCase). In that case i have no real project, but a stub, which is initialized in setUp method of LightCodeInsightFixtureTestCase. The test is compilable and runable, but the problem is in annotation analisis - method psiClass.getAnnotations[0].getQualifiedName()  only return string "Right", but not "com.sbt.access.Right". If i correctly understand, the problem is that stub doesn't have a information about access.jar file and it's content. And i don't know how to specify this.

Test Data:

package com.sbt;
import com.sbt.access.Right;
public class MyClass{

Surrely, access jar is specified in dependencies for a module in runtime.

Help me, please.

1 comment
Comment actions Permalink

You can make use of com.intellij.testFramework.PsiTestUtil#addLibrary :)


Please sign in to leave a comment.