Skip to content
Advertisement

Tag: validation

JUnit-Testing Custom Validation Annotations Java

Hei, I currently working on custom annotations for bean validation. To ensure the implemented validation logic is working as intended, i would like to implement unit-tests for these annotations. Sadly I am struggeling to find relevant guides/tutorials on Google. The most obvious solution is to create some class, stick the annotation on it and use the validatorFactory to start the

Why spring validator is not working in this Api?

I have written a basic simple API of students data and added few validations using Hibernate validator but everytime its returning 0 errors. Here’s the code: pom.xml student.java Controller.java I am testing it using postman,My request body: In every request,even if name is empty Its returning 0 errors. Can someone help? Thanks in advance. Answer you need to add starter

Fixed length Validation using Javax api

request response can be validated using javax annotation. However, need some help to have fixed length validation, as @Size(min=3, max=3). It is having message that ‘size must be between 3 and 3’. This is required to be changed. Answer If you want to change the default @Size message just declare parameter message into:

Advertisement