I'm trying to run test on repository class. In thi...
# konsist
s
I'm trying to run test on repository class. In this first test is not going to pass where as second test passing successfully.
Copy code
class RepositoryKonsistTest {

    @Test
    fun `classes ends with 'Repository' suffix should reside in 'domain-repository' package`() {
        Konsist
            .scopeFromModule("domain")
            .classes()
            .withNameEndingWith("Repository")
            .assert {
                it.resideInPackage("..domain.repository..")
            }
    }

    @Test
    fun `classes ends with 'RepositoryImpl' suffix should reside in 'data-repository' package`() {
        Konsist
            .scopeFromModule("data")
            .classes()
            .withNameEndingWith("RepositoryImpl")
            .assert {
                it.resideInPackage("..data.repository..")
            }
    }
}
Error :
Declaration list is empty. Please make sure that list of declarations contain items before calling the 'assert' method.
com.lemonappdev.konsist.core.exception.KoPreconditionFailedException at RepositoryKonsistTest.kt:16
What I'm missing here any idea ?
Screenshot 2023-09-07 at 1.25.18 PM.png
n
You should use
.interfaces()
instead of
.classes()
1
s
Thanks