validation-tck icon indicating copy to clipboard operation
validation-tck copied to clipboard

`@Min` validation a String

Open dstepanov opened this issue 1 year ago • 0 comments

Looking at this test org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution.ValidatorResolutionTest#testResolutionOfMinMaxForDifferentTypes

I don't understand why would @Min work on a String type; it's JavaDoc doesn't say anything about validating a String.

public class MinMax {
	@Min(10l)
	@Max(20l)
	Number number;

	@Min(10l)
	@Max(20l)
	String numberAsString;

	public MinMax(String stringNumber, Number number) {
		this.numberAsString = stringNumber;
		this.number = number;
	}
}

dstepanov avatar Jan 18 '24 12:01 dstepanov