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 ?
Asked
Active
Viewed 575 times
1

Rakesh Sharma
- 301
- 1
- 3
- 11
-
You do not require hibernate validator specifically, but you do require at least some implementation of beanvalidator API. You can import any of them (use search), and they should work pretty much the same, except maybe some initial setup. – M. Prokhorov Nov 21 '17 at 16:54
-
https://stackoverflow.com/users/7470253/m-prokhorov - I have searched for an alternative to hibernate-validator and could not find one, hence the question. – Rakesh Sharma Nov 21 '17 at 17:11
1 Answers
2
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.

Rakesh Sharma
- 301
- 1
- 3
- 11