File tree Expand file tree Collapse file tree 1 file changed +13
-18
lines changed
java/src/main/kotlin/cc/unitmesh/idea/provider Expand file tree Collapse file tree 1 file changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -108,27 +108,22 @@ open class JavaTestContextProvider : ChatContextProvider {
108108 }
109109
110110 var rule = " "
111- var hasJunit5 = false
112- var hasJunit4 = false
113- prepareLibraryData(project)?.forEach {
114- if (it.groupId == " org.junit.jupiter" ) {
115- hasJunit5 = true
116- return @forEach
117- }
118-
119- if (it.groupId == " junit" ) {
120- hasJunit4 = true
121- return @forEach
111+ val libraryData = prepareLibraryData(project)
112+ libraryData?.forEach {
113+ when (it.groupId) {
114+ " org.assertj" -> {
115+ rule + = " - This project uses AssertJ, you should import `org.assertj.core.api.Assertions` and use `assertThat` method."
116+ }
117+ " org.junit.jupiter" -> {
118+ rule + =
119+ " - This project uses JUnit 5, you should import `org.junit.jupiter.api.Test` and use `@Test` annotation."
120+ }
121+ " junit" -> {
122+ rule + = " - This project uses JUnit 4, you should import `org.junit.Test` and use `@Test` annotation."
123+ }
122124 }
123125 }
124126
125- if (hasJunit5) {
126- rule =
127- " - This project uses JUnit 5, you should import `org.junit.jupiter.api.Test` and use `@Test` annotation."
128- } else if (hasJunit4) {
129- rule = " - This project uses JUnit 4, you should import `org.junit.Test` and use `@Test` annotation."
130- }
131-
132127 projectJunitCache[project] = rule
133128 return rule
134129 }
You can’t perform that action at this time.
0 commit comments