-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add AccountUseCaseDomainArchitectureTest (#119)
- Loading branch information
1 parent
c301d14
commit bc44bf0
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
.../account/accountDomain/src/androidUnitTest/kotlin/AccountUseCaseDomainArchitectureTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |