File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
java/src/test/kotlin/cc/unitmesh/idea/context Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,12 @@ import com.intellij.lang.java.JavaLanguage
7
7
import com.intellij.psi.PsiFileFactory
8
8
import com.intellij.psi.PsiJavaFile
9
9
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
10
+ import org.intellij.lang.annotations.Language
10
11
11
12
class JavaClassContextTest : LightJavaCodeInsightFixtureTestCase () {
12
13
private val fileFactory: PsiFileFactory get() = PsiFileFactory .getInstance(project)
13
14
15
+ @Language(" Java" )
14
16
private val originCode = """
15
17
BlogService blogService;
16
18
@@ -49,6 +51,7 @@ public class BlogController {
49
51
}
50
52
""" .trimIndent()
51
53
54
+ @Language(" Java" )
52
55
private val serviceCode: String = """
53
56
package cc.unitmesh.untitled.demo.service;
54
57
@@ -106,11 +109,10 @@ class BlogController {
106
109
}
107
110
108
111
fun testShould_convert_function_to_string () {
109
- myFixture.addClass(serviceCode)
112
+ val serviceClass = myFixture.addClass(serviceCode)
110
113
myFixture.addClass(controllerCode)
111
114
112
- val serviceFile = myFixture.findClass(" cc.unitmesh.untitled.demo.service.BlogService" )
113
- val psiElement = serviceFile.methods[0 ]
115
+ val psiElement = serviceClass.methods[0 ]
114
116
val context = MethodContextProvider (false , true ).from(psiElement)
115
117
116
118
assertEquals(
You can’t perform that action at this time.
0 commit comments