https://kotlinlang.org logo
#konsist
Title
# konsist
s

Swapnil Musale

09/07/2023, 7:54 AM
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

Natalia Peterwas

09/07/2023, 8:26 AM
You should use
.interfaces()
instead of
.classes()
1
s

Swapnil Musale

09/07/2023, 8:27 AM
Thanks
7 Views