mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 23:06:24 +07:00
[jvm] Move AssertEqualsBetweenInconvertibleTypes inspection to test package
GitOrigin-RevId: 9acea3f96beb05c02ec1cb5f0592199690cc6ccd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5aa86e6154
commit
561e62ca18
@@ -12,7 +12,7 @@
|
||||
groupBundle="messages.JvmAnalysisBundle" bundle="messages.JvmAnalysisBundle"
|
||||
groupPathKey="jvm.inspections.group.name" groupKey="jvm.inspections.test.frameworks.group.name"
|
||||
key="assertequals.between.inconvertible.types.display.name"
|
||||
implementationClass="com.intellij.codeInspection.AssertBetweenInconvertibleTypesInspection"/>
|
||||
implementationClass="com.intellij.codeInspection.test.AssertBetweenInconvertibleTypesInspection"/>
|
||||
<localInspection language="UAST" enabledByDefault="false" level="WARNING" shortName="TestOnlyProblems"
|
||||
groupBundle="messages.JvmAnalysisBundle" bundle="messages.JvmAnalysisBundle"
|
||||
groupPathKey="jvm.inspections.group.name" groupKey="jvm.inspections.test.frameworks.group.name"
|
||||
|
||||
+5
-2
@@ -1,7 +1,10 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.test
|
||||
|
||||
import com.intellij.analysis.JvmAnalysisBundle
|
||||
import com.intellij.codeInspection.AbstractBaseUastLocalInspectionTool
|
||||
import com.intellij.codeInspection.ProblemHighlightType
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.CommonClassNames
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.intellij.codeInspection.tests.java
|
||||
package com.intellij.codeInspection.tests.java.test
|
||||
|
||||
import com.intellij.codeInspection.tests.AssertEqualsBetweenInconvertibleTypesInspectionTestBase
|
||||
import com.intellij.codeInspection.tests.test.AssertEqualsBetweenInconvertibleTypesInspectionTestBase
|
||||
import com.intellij.jvm.analysis.JavaJvmAnalysisTestUtil
|
||||
|
||||
class JavaAssertEqualsBetweenInconvertibleTypesInspectionTest : AssertEqualsBetweenInconvertibleTypesInspectionTestBase() {
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
package com.intellij.codeInspection.tests.kotlin
|
||||
package com.intellij.codeInspection.tests.kotlin.test
|
||||
|
||||
import com.intellij.codeInspection.tests.AssertEqualsBetweenInconvertibleTypesInspectionTestBase
|
||||
import com.intellij.codeInspection.tests.test.AssertEqualsBetweenInconvertibleTypesInspectionTestBase
|
||||
import com.intellij.jvm.analysis.KotlinJvmAnalysisTestUtil
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
|
||||
@@ -9,7 +9,8 @@ private const val inspectionPath = "/codeInspection/assertEqualsBetweenInconvert
|
||||
@TestDataPath("\$CONTENT_ROOT/testData$inspectionPath")
|
||||
class KotlinAssertEqualsBetweenInconvertibleTypesTest : AssertEqualsBetweenInconvertibleTypesInspectionTestBase() {
|
||||
override fun getBasePath() = KotlinJvmAnalysisTestUtil.TEST_DATA_PROJECT_RELATIVE_BASE_PATH + inspectionPath
|
||||
|
||||
fun `test AssertEqualsBetweenInconvertibleTypes`() {
|
||||
myFixture.testHighlighting("AssertEqualsBetweenInconvertibleTypes.kt")
|
||||
}
|
||||
}
|
||||
}
|
||||
-97
@@ -1,97 +0,0 @@
|
||||
package com.intellij.codeInspection.tests
|
||||
|
||||
import com.intellij.codeInspection.AssertBetweenInconvertibleTypesInspection
|
||||
import com.intellij.codeInspection.InspectionProfileEntry
|
||||
|
||||
open class AssertEqualsBetweenInconvertibleTypesInspectionTestBase : JvmInspectionTestBase() {
|
||||
|
||||
override val inspection: InspectionProfileEntry = AssertBetweenInconvertibleTypesInspection()
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.junit.jupiter.api;
|
||||
import java.util.function.Supplier;
|
||||
public final class Assertions {
|
||||
public static void assertEquals(double expected, double actual) {}
|
||||
public static void assertEquals(double expected, double actual, String message) {}
|
||||
public static void assertEquals(double expected, double actual, Supplier<String> messageSupplier) {}
|
||||
public static void assertEquals(Object expected, Object actual) {}
|
||||
public static void assertEquals(Object expected, Object actual, String message) {}
|
||||
public static void assertEquals(Object expected, Object actual, Supplier<String> messageSupplier) {}
|
||||
public static void assertNotEquals(Object expected, Object actual) {}
|
||||
public static void assertNotEquals(Object expected, Object actual, String message) {}
|
||||
public static void assertNotEquals(Object expected, Object actual, Supplier<String> messageSupplier) {}
|
||||
public static void assertSame(Object expected, Object actual) {}
|
||||
public static void assertSame(Object expected, Object actual, String message) {}
|
||||
public static void assertSame(Object expected, Object actual, Supplier<String> messageSupplier) {}
|
||||
public static void assertNotSame(Object expected, Object actual) {}
|
||||
public static void assertNotSame(Object expected, Object actual, String message) {}
|
||||
public static void assertNotSame(Object expected, Object actual, Supplier<String> messageSupplier) {}
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.junit;
|
||||
public class Assert {
|
||||
static public void assertEquals(double expected, double actual, double delta) {}
|
||||
static public void assertEquals(Object expected, Object actual){}
|
||||
static public void assertNotEquals(Object expected, Object actual){}
|
||||
static public void assertSame(Object expected, Object actual){}
|
||||
static public void assertNotSame(Object expected, Object actual){}}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.junit;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Test {}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.junit.jupiter.api;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Test {}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public class Assertions {
|
||||
public static <T> ObjectAssert<T> assertThat(T actual);
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public class Assert<SELF extends Assert<SELF, ACTUAL>, ACTUAL> extends Descriptable<SELF> {
|
||||
public SELF isEqualTo(Object expected);
|
||||
public SELF isNotEqualTo(Object expected);
|
||||
public SELF isSameAs(Object expected);
|
||||
public SELF isNotSameAs(Object expected);
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public class ObjectAssert<T> extends Assert<ObjectAssert<T>, T> {}
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public interface Descriptable<SELF> {
|
||||
SELF describedAs(String description, Object... args);
|
||||
default SELF as(String description, Object... args);
|
||||
SELF isEqualTo(Object expected);}
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.intellij.codeInspection.tests.test
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry
|
||||
import com.intellij.codeInspection.test.AssertBetweenInconvertibleTypesInspection
|
||||
import com.intellij.codeInspection.tests.JvmInspectionTestBase
|
||||
import com.intellij.codeInspection.tests.test.junit.addJUnit3Library
|
||||
import com.intellij.codeInspection.tests.test.junit.addJUnit5Library
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.roots.ContentEntry
|
||||
import com.intellij.openapi.roots.ModifiableRootModel
|
||||
import com.intellij.pom.java.LanguageLevel
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
|
||||
open class AssertEqualsBetweenInconvertibleTypesInspectionTestBase : JvmInspectionTestBase() {
|
||||
override val inspection: InspectionProfileEntry = AssertBetweenInconvertibleTypesInspection()
|
||||
|
||||
protected open class JUnitProjectDescriptor(languageLevel: LanguageLevel) : ProjectDescriptor(languageLevel) {
|
||||
override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) {
|
||||
super.configureModule(module, model, contentEntry)
|
||||
model.addJUnit3Library()
|
||||
model.addJUnit5Library()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = JUnitProjectDescriptor(sdkLevel)
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public class Assertions {
|
||||
public static <T> ObjectAssert<T> assertThat(T actual);
|
||||
}
|
||||
""".trimIndent())
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public class Assert<SELF extends Assert<SELF, ACTUAL>, ACTUAL> extends Descriptable<SELF> {
|
||||
public SELF isEqualTo(Object expected);
|
||||
public SELF isNotEqualTo(Object expected);
|
||||
public SELF isSameAs(Object expected);
|
||||
public SELF isNotSameAs(Object expected);
|
||||
}
|
||||
""".trimIndent())
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public class ObjectAssert<T> extends Assert<ObjectAssert<T>, T> {}
|
||||
""".trimIndent())
|
||||
myFixture.addClass("""
|
||||
package org.assertj.core.api;
|
||||
public interface Descriptable<SELF> {
|
||||
SELF describedAs(String description, Object... args);
|
||||
default SELF as(String description, Object... args);
|
||||
SELF isEqualTo(Object expected);}
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user