It is likely there is not a solution, but I hope I am wrong.
I am writing a JUnit5 test to test some model classes. Some fields of the model classes are annotated by Lombok @NonNull
which has CLASS level RetentionPolicy.
I want to make sure the Java model classes always comply with some constraints described by a schema. The schema defines which fields are required and which are not. In JUnit test, I want to make sure all fields that are required are annotated by Lombok @NonNull
.
However, since the annotation is not a RUNTIME annotation, I do not have access to it in unit test.
Are there any workaround that can achieve my goal to automatically verify the constraint?
Aucun commentaire:
Enregistrer un commentaire