@Test public void testWheels() throws Exception { Car car = new Car(); car.setInsured(InsuranceType.HUS); Motor motor = new Motor(); motor.setCcm(200); car.setMotor(motor); car.setRegistered(DateUtils.addDays(new Date(), 10)); car.setLength(2000); Wheel leftFrontWheel = new Wheel(); leftFrontWheel.setPosition("LEFT_FRONT"); leftFrontWheel.setDiameter(10); car.addWheel(leftFrontWheel); Set<ConstraintViolation<Car>> violations = CustomVehicleTest.validator.validate(car); for (ConstraintViolation<Car> constraintViolation : violations) { System.out.println( constraintViolation.getPropertyPath() + ", " + constraintViolation.getMessage()); } }