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

This commit is contained in:
Benoit Marty
2024-05-31 09:34:45 +02:00
parent 155fd4ab81
commit c0b00b0091

View File

@@ -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 {
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'")
}
}