How to write IntelliJ plugin that modify Kotlin class to annotate it with @RunWith(MockitoJUnitRunner.class)
?
I've tried the following code:
KtPsiFactory(ktFile.project).createAnnotationEntry("@RunWith(MockitoJUnitRunner.class)")
but it throws
0 declarations in @RunWith(MockitoJUnitRunner.class) val x
java.lang.AssertionError: 0 declarations in @RunWith(MockitoJUnitRunner.class) val x
at org.jetbrains.kotlin.psi.KtPsiFactory.createDeclaration(KtPsiFactory.kt:288)
However it works for @Ignore
Ah.. It should be @RunWith(MockitoJUnitRunner::class)