mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Konsist: check if sealed class could be sealed interface and fix existing issues.
This commit is contained in:
committed by
Benoit Marty
parent
ddc1e1d0cc
commit
3092ca23f0
+12
@@ -21,7 +21,9 @@ import com.lemonappdev.konsist.api.ext.list.constructors
|
||||
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withSealedModifier
|
||||
import com.lemonappdev.konsist.api.ext.list.parameters
|
||||
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith
|
||||
import com.lemonappdev.konsist.api.ext.list.withoutConstructors
|
||||
import com.lemonappdev.konsist.api.ext.list.withoutName
|
||||
import com.lemonappdev.konsist.api.ext.list.withoutParents
|
||||
import com.lemonappdev.konsist.api.verify.assertEmpty
|
||||
import com.lemonappdev.konsist.api.verify.assertTrue
|
||||
import org.junit.Test
|
||||
@@ -55,4 +57,14 @@ class KonsistArchitectureTest {
|
||||
.withNameEndingWith("Events")
|
||||
.assertEmpty(additionalMessage = "Events class MUST be sealed interface")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Sealed class without constructor and without parent MUST be sealed interface`() {
|
||||
Konsist.scopeFromProject()
|
||||
.classes()
|
||||
.withSealedModifier()
|
||||
.withoutConstructors()
|
||||
.withoutParents()
|
||||
.assertEmpty(additionalMessage = "Sealed class without constructor MUST be sealed interface")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user