Browse Source

Add Konsist test about class name: Class implementing interface should have name not end with 'Impl' but start with 'Default'

pull/2957/head
Benoit Marty 4 months ago
parent
commit
cf4497d323
  1. 10
      tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt

10
tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt

@ -21,7 +21,9 @@ import com.bumble.appyx.core.node.Node @@ -21,7 +21,9 @@ import com.bumble.appyx.core.node.Node
import com.lemonappdev.konsist.api.Konsist
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
import com.lemonappdev.konsist.api.ext.list.withNameContaining
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith
import com.lemonappdev.konsist.api.ext.list.withoutName
import com.lemonappdev.konsist.api.verify.assertEmpty
import com.lemonappdev.konsist.api.verify.assertTrue
import io.element.android.libraries.architecture.Presenter
import org.junit.Test
@ -81,4 +83,12 @@ class KonsistClassNameTest { @@ -81,4 +83,12 @@ class KonsistClassNameTest {
it.parents().any { parent -> parent.name.replace(".", "") == interfaceName }
}
}
@Test
fun `Class implementing interface should have name not end with 'Impl' but start with 'Default'`() {
Konsist.scopeFromProject()
.classes()
.withNameEndingWith("Impl")
.assertEmpty(additionalMessage = "Class implementing interface should have name not end with 'Impl' but start with 'Default'")
}
}

Loading…
Cancel
Save