Skip to content

Commit

Permalink
refactor(test): update for method code
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Oct 5, 2024
1 parent 95002f6 commit 2bc3236
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import com.intellij.lang.java.JavaLanguage
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.PsiJavaFile
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import org.intellij.lang.annotations.Language

class JavaClassContextTest : LightJavaCodeInsightFixtureTestCase() {
private val fileFactory: PsiFileFactory get() = PsiFileFactory.getInstance(project)

@Language("Java")
private val originCode = """
BlogService blogService;
Expand Down Expand Up @@ -49,6 +51,7 @@ public class BlogController {
}
""".trimIndent()

@Language("Java")
private val serviceCode: String = """
package cc.unitmesh.untitled.demo.service;
Expand Down Expand Up @@ -106,11 +109,10 @@ class BlogController {
}

fun testShould_convert_function_to_string() {
myFixture.addClass(serviceCode)
val serviceClass = myFixture.addClass(serviceCode)
myFixture.addClass(controllerCode)

val serviceFile = myFixture.findClass("cc.unitmesh.untitled.demo.service.BlogService")
val psiElement = serviceFile.methods[0]
val psiElement = serviceClass.methods[0]
val context = MethodContextProvider(false, true).from(psiElement)

assertEquals(
Expand Down

0 comments on commit 2bc3236

Please sign in to comment.