@Test public void testScriptAssert() { Set<ConstraintViolation<ObjectWithValidation>> violations = validator.validate(obj, ScriptAssert.class); assertNotNull(violations); assertEquals(violations.size(), 1); if (runPeformance) { long time = System.currentTimeMillis(); for (int index = 0; index < 10000; index++) { validator.validate(obj, ScriptAssert.class); } long used = System.currentTimeMillis() - time; System.out.println("Hibernate Validator [ScriptAssert] check used " + used + "ms, avg. " + ((double) used) / 10000 + "ms."); } }
/** * (non-Javadoc) * * @see com.github.nest.arcteryx.meta.beans.internal.validators.hibernate.convertors.AbstractHibernateConstraintConvertor#registerErrorCode() */ @Override protected void registerErrorCode() { HibernateErrorCodeRegistry.registerErrorCode(ScriptAssert.class, BeanScriptConstraint.class.getSimpleName()); }