Idea 2024.3.2.2 does not respect kotlin test file template

已回答

Not that long ago I noticed that IDE started to generate test templates with bad formatting, like so

package ...

import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions.*
 class Cs21LauncherTest {

@Test
 fun launch() {}
}

When I have standard kotlin code style with 4 spaces of indentation.

Moreover, I found test template, modified imports to my needs, but this also is not used by IDE.

I found out that IDE is creating java test class first, and then converts it to kotlin with bad indents. Why?

I am creating tests like this

1
I failed to reproduce the problem. Can you create an issue (https://kotl.in/plugin-issue) and attach a video with the steps to reproduce the problem? Can you try to disable all third-party plugins in your IDE and check the problem?
0

Can confirm the issue, java Junit5 test template is used instead of kotlin Junit5 test template

0

And to add one more thing – generating a test class doesn't work for Kotlin `interface`, but works for Java `interface`.
Interface might be annotated and generate some code that needs to be unit-tested, eg. Mapstruct

0

请先登录再写评论。