diff --git a/idea/resources/inspectionDescriptions/MainFunctionReturnUnit.html b/idea/resources/inspectionDescriptions/MainFunctionReturnUnit.html
index 7043219f03d..026b0ead172 100644
--- a/idea/resources/inspectionDescriptions/MainFunctionReturnUnit.html
+++ b/idea/resources/inspectionDescriptions/MainFunctionReturnUnit.html
@@ -1,5 +1,5 @@
-This inspection reports a main function with incorrect return type (should be Unit).
+This inspection reports a entry point function with incorrect return type (should be Unit).
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 5fb736da19f..ad7edcab688 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -2856,7 +2856,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
/>
() = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit4Test.kt.after b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit4Test.kt.after
new file mode 100644
index 00000000000..3e908b6c8cc
--- /dev/null
+++ b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit4Test.kt.after
@@ -0,0 +1,10 @@
+// PROBLEM: JUnit test should return Unit
+// FIX: Add explicit Unit return type
+// DISABLE-ERRORS
+package org.junit
+
+annotation class Test
+
+class A {
+ @Test fun foo(): Unit = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt
new file mode 100644
index 00000000000..d3f4eddeeb0
--- /dev/null
+++ b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt
@@ -0,0 +1,9 @@
+// FIX: Add explicit Unit return type
+// DISABLE-ERRORS
+package org.junit.jupiter.api
+
+annotation class Test
+
+class A {
+ @Test fun foo() = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt.after b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt.after
new file mode 100644
index 00000000000..ae475e95a63
--- /dev/null
+++ b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt.after
@@ -0,0 +1,9 @@
+// FIX: Add explicit Unit return type
+// DISABLE-ERRORS
+package org.junit.jupiter.api
+
+annotation class Test
+
+class A {
+ @Test fun foo(): Unit = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt
index f5effba3b7a..de1a6a306e6 100644
--- a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt
+++ b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt
@@ -1,3 +1,4 @@
+// PROBLEM: main should return Unit
// FIX: Add explicit Unit return type
// DISABLE-ERRORS
fun main(args: Array) = 1
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt.after b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt.after
index f3bb7eeaee2..a508b572c4a 100644
--- a/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt.after
+++ b/idea/testData/inspectionsLocal/mainFunctionReturnUnit/notUnit1.kt.after
@@ -1,3 +1,4 @@
+// PROBLEM: main should return Unit
// FIX: Add explicit Unit return type
// DISABLE-ERRORS
fun main(args: Array): Unit = 1
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
index 88ea97f6000..90b00ea0e9e 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
@@ -2383,6 +2383,16 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/mainFunctionReturnUnit"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
}
+ @TestMetadata("junit4Test.kt")
+ public void testJunit4Test() throws Exception {
+ runTest("idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit4Test.kt");
+ }
+
+ @TestMetadata("junit5Test.kt")
+ public void testJunit5Test() throws Exception {
+ runTest("idea/testData/inspectionsLocal/mainFunctionReturnUnit/junit5Test.kt");
+ }
+
@TestMetadata("notMain.kt")
public void testNotMain() throws Exception {
runTest("idea/testData/inspectionsLocal/mainFunctionReturnUnit/notMain.kt");