Rename `TestMethodDetector` to `TestMethodNameDetector` as suggested

pull/899/head
Simon Marquis 1 year ago
parent 4732249443
commit ba19aa6da0

@ -25,9 +25,9 @@ class NiaIssueRegistry : IssueRegistry() {
override val issues = listOf( override val issues = listOf(
DesignSystemDetector.ISSUE, DesignSystemDetector.ISSUE,
TestMethodDetector.UNDERSCORE, TestMethodNameDetector.UNDERSCORE,
TestMethodDetector.FORMAT, TestMethodNameDetector.FORMAT,
TestMethodDetector.PREFIX, TestMethodNameDetector.PREFIX,
) )
override val api: Int = CURRENT_API override val api: Int = CURRENT_API

@ -40,7 +40,7 @@ import kotlin.io.path.Path
* - [detectUnderscore] removes underscores in JVM unit test (and add backticks if necessary). * - [detectUnderscore] removes underscores in JVM unit test (and add backticks if necessary).
* - [detectFormat] Checks the `given_when_then` format of Android instrumented tests (backticks are not supported). * - [detectFormat] Checks the `given_when_then` format of Android instrumented tests (backticks are not supported).
*/ */
class TestMethodDetector : Detector(), SourceCodeScanner { class TestMethodNameDetector : Detector(), SourceCodeScanner {
override fun applicableAnnotations() = listOf("org.junit.Test") override fun applicableAnnotations() = listOf("org.junit.Test")
@ -131,7 +131,7 @@ class TestMethodDetector : Detector(), SourceCodeScanner {
priority = 5, priority = 5,
severity = WARNING, severity = WARNING,
implementation = Implementation( implementation = Implementation(
TestMethodDetector::class.java, TestMethodNameDetector::class.java,
EnumSet.of(JAVA_FILE, TEST_SOURCES), EnumSet.of(JAVA_FILE, TEST_SOURCES),
), ),
) )

@ -19,12 +19,12 @@ package com.google.samples.apps.nowinandroid.lint
import com.android.tools.lint.checks.infrastructure.TestFile import com.android.tools.lint.checks.infrastructure.TestFile
import com.android.tools.lint.checks.infrastructure.TestFiles.kotlin import com.android.tools.lint.checks.infrastructure.TestFiles.kotlin
import com.android.tools.lint.checks.infrastructure.TestLintTask.lint import com.android.tools.lint.checks.infrastructure.TestLintTask.lint
import com.google.samples.apps.nowinandroid.lint.TestMethodDetector.Companion.FORMAT import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.FORMAT
import com.google.samples.apps.nowinandroid.lint.TestMethodDetector.Companion.PREFIX import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.PREFIX
import com.google.samples.apps.nowinandroid.lint.TestMethodDetector.Companion.UNDERSCORE import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.UNDERSCORE
import org.junit.Test import org.junit.Test
class TestMethodDetectorTest { class TestMethodNameDetectorTest {
@Test @Test
fun `detect prefix`() { fun `detect prefix`() {
Loading…
Cancel
Save