简体   繁体   中英

Javax Annotation Validation JUnit without Hibernate validator

I have a jax-rs project that uses javax annotations ( @NotNull, @Pattern etc. ). I want to add unit tests for validating these annotations, but unfortunately cannot use the hibernate-validator (company maven repo does not have it) as suggested in this answer. Is there any other way to validate the annotations using unit tests ?

Apache's Bval provides a validator implementation that can serve as an alternative to hibernate-validator. Here's an example for getting started on using Bval.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM