mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
[Java. Logging] Add tests for lombok based logger
IDEA-345098 GitOrigin-RevId: 41691d38bd4403f9befde7ea338113c50e7c6199
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0eae1f68c1
commit
c095ac545e
@@ -29,5 +29,6 @@
|
||||
<orderEntry type="module" module-name="intellij.java.impl.inspections" />
|
||||
<orderEntry type="module" module-name="intellij.java.impl.refactorings" />
|
||||
<orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.java.tests" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.intellij.java.lomboktest
|
||||
|
||||
import com.intellij.codeInsight.completion.JvmLoggerLookupElement
|
||||
import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase
|
||||
import com.intellij.java.codeInsight.JvmLoggerTestSetupUtil
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import de.plushnikov.intellij.plugin.LombokTestUtil
|
||||
import de.plushnikov.intellij.plugin.logging.LombokLoggingUtils
|
||||
import junit.framework.TestCase
|
||||
|
||||
class LombokLoggerCompletionTest : LightFixtureCompletionTestCase() {
|
||||
fun testSlf4j() {
|
||||
JvmLoggerTestSetupUtil.setupSlf4j(myFixture)
|
||||
|
||||
doTest(LombokLoggingUtils.SLF4J_ANNOTATION, "long", "log", "log", "clone")
|
||||
}
|
||||
|
||||
fun testLog4j2() {
|
||||
JvmLoggerTestSetupUtil.setupLog4j2(myFixture)
|
||||
|
||||
doTest(LombokLoggingUtils.LOG4J2_ANNOTATION, "long", "log", "log", "clone")
|
||||
}
|
||||
|
||||
fun testLog4j() {
|
||||
JvmLoggerTestSetupUtil.setupLog4j(myFixture)
|
||||
|
||||
doTest(LombokLoggingUtils.LOG4J_ANNOTATION, "long", "log", "log", "clone")
|
||||
}
|
||||
|
||||
fun testApacheCommons() {
|
||||
JvmLoggerTestSetupUtil.setupApacheCommons(myFixture)
|
||||
|
||||
doTest(LombokLoggingUtils.COMMONS_ANNOTATION, "long", "log", "log", "clone")
|
||||
}
|
||||
|
||||
override fun getBasePath(): String = "community/plugins/lombok/testData/completion/logger"
|
||||
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = LombokTestUtil.LOMBOK_OLD_DESCRIPTOR
|
||||
|
||||
private fun doTest(typeName: String, vararg names: String) {
|
||||
val name = getTestName(false)
|
||||
configureByFile("before$name.java")
|
||||
assertStringItems(*names)
|
||||
|
||||
val item = lookup.items.find { it is JvmLoggerLookupElement && it.typeName == typeName }
|
||||
TestCase.assertNotNull(item)
|
||||
selectItem(item)
|
||||
checkResultByFile("after$name.java")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import lombok.extern.apachecommons.CommonsLog;
|
||||
|
||||
@CommonsLog
|
||||
public class A {
|
||||
void foo() {
|
||||
log
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
@Log4j
|
||||
public class A {
|
||||
void foo() {
|
||||
log
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
||||
@Log4j2
|
||||
public class A {
|
||||
void foo() {
|
||||
log
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class A {
|
||||
void foo() {
|
||||
log
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
void foo() {
|
||||
lo<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
void foo() {
|
||||
lo<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
void foo() {
|
||||
lo<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
void foo() {
|
||||
lo<caret>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user