Skip to content

Commit

Permalink
fix(provider): fix KotlinTestDataBuilderTest and KotlinClassContextBu…
Browse files Browse the repository at this point in the history
…ilder

- Fix KotlinTestDataBuilderTest to include package name in outboundData assertion.
- Fix KotlinClassContextBuilder to set displayName based on fqName or name.
  • Loading branch information
phodal committed Jan 10, 2024
1 parent b2694c9 commit d23b9d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -28,7 +28,8 @@ class KotlinClassContextBuilder : ClassContextBuilder {
val usages =
if (gatherUsages) JavaContextCollection.findUsages(psiElement as PsiNameIdentifierOwner) else emptyList()

return ClassContext(psiElement, text, name, ktNamedFunctions, allFields, null, usages)
val displayName = psiElement.fqName?.asString() ?: psiElement.name ?: ""
return ClassContext(psiElement, text, name, ktNamedFunctions, allFields, null, usages, displayName = displayName)
}

companion object {
Expand Down
Expand Up @@ -44,7 +44,7 @@ class KotlinTestDataBuilderTest : LightPlatformTestCase() {

assertEquals(outboundData.size, 1)
assertEquals(
outboundData["cc.unitmesh.untitled.demo.controller.UserDTO"], "'package: null\n" +
outboundData["cc.unitmesh.untitled.demo.controller.UserDTO"], "'package: cc.unitmesh.untitled.demo.controller.UserDTO\n" +
"class UserDTO {\n" +
" \n" +
" \n" +
Expand Down

0 comments on commit d23b9d5

Please sign in to comment.