How get I get PsiElement instance for specified testData's code file into junit test?

Answered

Hello, I'm writing a codegen Intellij IDEA Plugin and I want to test my plugin whether it parse code correctly.

My project folder structure:

└── src
    ├── main
    │   ├── kotlin
    │   └── resources
    └── test
        ├── kotlin
        └── testData

I place all test code into src/test/testData folder(like SimpleKtClass.kt or SimpleJavaClass.java).

How can parsed src/test/testData/SimpleKtClass.kt and get it as PsiFile Instance into junit test?

Thanks!

Please sign in to leave a comment.