Skip to content
Advertisement

Tag: bean-validation

How to unit test methods together with its constraint validators (which some should be mocked out)?

My app has a service layer which is composed by CDI applications scoped beans: When a method gets called, an interceptor (in my case BValInterceptor.class from Apache BVal) checks if the method contract is respected by checking the annotations and validating the parameters accordingly. As you can see, there are some custom constraints like @SectionExists, @PostExists that may hit the

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

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:

Validation issue with javax constraint

In a spring boot application, I have an entity where I put some annotation validation. Value for theses files I get many error Freq have one character, why i get this message? Empty value is lower then 17 for currency.. I don’t understand why this error occur. Answer The @Max annotation are validation for these types: BigDecimal, BigInteger, byte, short,

Spring Bean Validation @Valid handling

I have created a Spring MVC REST service using Bean Validation 1.2 with the following method: If object isn’t valid, Tomcat informs me that The request sent by the client was syntactically incorrect. and my validatedMethod is never called. How can I get the message that was defined in the ValidObject bean? Should I use some filter or interceptor? I

Advertisement