From cf4497d323a9e9438821f69d8a89c6ceac0f1e51 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 31 May 2024 09:34:45 +0200 Subject: [PATCH] Add Konsist test about class name: Class implementing interface should have name not end with 'Impl' but start with 'Default' --- .../android/tests/konsist/KonsistClassNameTest.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt index 3ac03680ff..679191975f 100644 --- a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt +++ b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt @@ -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'") + } }