ArchUnit test for Sharded fields for a domain class #1395
Unanswered
Vignesh413
asked this question in
Q&A
Replies: 1 comment 2 replies
-
There are some static methodsimport static com.tngtech.archunit.base.DescribedPredicate.describe;
import static com.tngtech.archunit.lang.conditions.ArchConditions.have;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;that allow you to write @ArchTest
ArchRule shardedClassesHaveShardKey =
classes()
.that().areAnnotatedWith(Sharded.class)
.should(have(describe("a shardKey", shardedClass ->
shardedClass.getAnnotationOfType(Sharded.class).shardKey().length > 0
))); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to write an ArchUnit test case for validating the existence of
shardKeyfields inside a domain class that is annotated with@Shardedmy domain will like below:Beta Was this translation helpful? Give feedback.
All reactions