Skip to content

Commit

Permalink
feat: Add AccountUseCaseDomainArchitectureTest (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
behzodhalil committed Oct 18, 2023
1 parent c301d14 commit bc44bf0
Showing 1 changed file with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import com.lemonappdev.konsist.api.Konsist
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith
import com.lemonappdev.konsist.api.verify.assertTrue
import org.junit.Test

class AccountUseCaseDomainArchitectureTest {

@Test
fun `check account use case classes with 'UseCase' suffix in 'usecase' package`() {
Konsist
.scopeFromPackage("io.spherelabs.accountdomain.usecase")
.classes()
.run {
assertTrue {
it.hasNameEndingWith("UseCase")
}
assertTrue {
it.resideInPackage("..usecase..")
}
}
}

@Test
fun `check account use case interfaces with 'UseCase' suffx in 'usecase' package`() {
Konsist
.scopeFromPackage("io.spherelabs.accountdomain.usecase")
.interfaces()
.run {
assertTrue {
it.hasNameEndingWith("UseCase")
}
assertTrue {
it.resideInPackage("..usecase..")
}
}
}


@Test
fun `check account interface with 'Repository' suffix in 'repository' package`() {
Konsist
.scopeFromPackage("io.spherelabs.accountdomain.repository")
.interfaces()
.withNameEndingWith("Repository")
.assertTrue {
it.resideInPackage("..repository..")
}
}

@Test
fun `check use case function name is execute`() {
Konsist
.scopeFromPackage("io.spherelabs.accountdomain.usecase")
.classes()
.withNameEndingWith("UseCase")
.assertTrue {
it.hasFunction { function ->
function.name == "execute" && function.hasOverrideModifier
}
}
}
}

0 comments on commit bc44bf0

Please # to comment.