mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Java. Tests] IDEA-381948 Refactoring test name fixture and code insight fixture
GitOrigin-RevId: 96d9b19e8cf5ee8cd0a98f250521174237f00550
This commit is contained in:
committed by
intellij-monorepo-bot
parent
baa8b82647
commit
21de9c8b91
@@ -44,7 +44,7 @@ public class ForCanBeForeachInspectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void forCanBeForEach() {
|
||||
void testForCanBeForEach() {
|
||||
fixture.get().testHighlighting(testName.get() + ".java");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class TryFinallyCanBeTryWithResourcesInspectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun tryFinallyCanBeTryWithResources() {
|
||||
fun testTryFinallyCanBeTryWithResources() {
|
||||
fixture.testHighlighting("$testName.java")
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ fun codeInsightFixture(
|
||||
fun <T: CodeInsightTestFixture> codeInsightFixture(
|
||||
projectFixture: TestFixture<Project>,
|
||||
tempDirFixture: TestFixture<Path>,
|
||||
fixtureConstructor: (IdeaProjectTestFixture, TempDirTestFixture) -> T,
|
||||
createFixture: (IdeaProjectTestFixture, TempDirTestFixture) -> T,
|
||||
): TestFixture<T> = testFixture { context ->
|
||||
val project = projectFixture.init()
|
||||
val tempDir = tempDirFixture.init()
|
||||
@@ -89,7 +89,7 @@ fun <T: CodeInsightTestFixture> codeInsightFixture(
|
||||
override fun deleteOnTearDown(): Boolean = false
|
||||
}
|
||||
|
||||
val codeInsightFixture = fixtureConstructor(projectFixture, tempDirFixture)
|
||||
val codeInsightFixture = createFixture(projectFixture, tempDirFixture)
|
||||
|
||||
codeInsightFixture.testDataPath = getTestDataPathString(context)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ internal class TestContextImpl(private val context: ExtensionContext, override v
|
||||
if (name.startsWith("test") && name.length > 4) name.removePrefix("test").trimStart()
|
||||
else name
|
||||
}
|
||||
.replaceFirstChar { it.lowercaseChar() }
|
||||
|
||||
override fun <T : Annotation> findAnnotation(clazz: Class<T>): T? {
|
||||
var extContext: ExtensionContext? = context
|
||||
|
||||
@@ -51,8 +51,10 @@ import kotlin.io.path.exists
|
||||
@JvmOverloads
|
||||
@TestOnly
|
||||
fun testNameFixture(lowerCaseFirstLetter: Boolean = true): TestFixture<String> = testFixture {
|
||||
val testName = it.testName.replaceFirstChar {
|
||||
chr -> if (lowerCaseFirstLetter) chr.lowercaseChar() else chr.uppercaseChar()
|
||||
val testName = if (lowerCaseFirstLetter) {
|
||||
it.testName.replaceFirstChar { chr -> chr.lowercaseChar() }
|
||||
} else {
|
||||
it.testName
|
||||
}
|
||||
|
||||
initialized(testName) {}
|
||||
|
||||
Reference in New Issue
Block a user