Package javax.validation

Examples of javax.validation.ConstraintViolationException


        try {
            persistManager.persistNotValid();
            fail();
        } catch (final EJBException ejbException) {
            assertTrue(ejbException.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException constraintViolationException = (ConstraintViolationException) ejbException.getCause();
            assertEquals(1, constraintViolationException.getConstraintViolations().size());
        }
    }
View Full Code Here


        try {
            p = mgr.create(null);
            fail();
        } catch (final Exception e) {
            assertTrue(e.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException cvs = (ConstraintViolationException) e.getCause();
            assertEquals(1, cvs.getConstraintViolations().size());
        }
        try {
            mgr.drive(p, 17);
            fail();
        } catch (final Exception e) {
            assertTrue(e.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException cvs = (ConstraintViolationException) e.getCause();
            assertEquals(1, cvs.getConstraintViolations().size());
        }
    }
View Full Code Here

        try {
            mgrRemote.drive(p, 15);
            fail();
        } catch (final Exception e) {
            assertTrue(e.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException cvs = (ConstraintViolationException) e.getCause();
            assertEquals(1, cvs.getConstraintViolations().size());
        }
    }
View Full Code Here

        try {
            mgrLB.foo(null);
            fail();
        } catch (final Exception e) {
            assertTrue(e.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException cvs = (ConstraintViolationException) e.getCause();
            assertEquals(1, cvs.getConstraintViolations().size());
        }
    }
View Full Code Here

            try {
                final Validator validator = (Validator) beanContext.getJndiContext().lookup("comp/Validator");

                final Set generalSet = validator.validate(activationSpec);
                if (!generalSet.isEmpty()) {
                    throw new ConstraintViolationException("Constraint violation for ActivationSpec " + activationSpecClass.getName(), generalSet);
                }
            } catch (final NamingException e) {
                logger.debug("No Validator bound to JNDI context");
            }
View Full Code Here

    }


    // just a simple EJBException for now
    private RuntimeException buildValidationException(final Set<ConstraintViolation<?>> violations) {
        return new ConstraintViolationException(violations);
    }
View Full Code Here

        try {
            persistManager.persistNotValid();
            fail();
        } catch (final EJBException ejbException) {
            assertTrue(ejbException.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException constraintViolationException = (ConstraintViolationException) ejbException.getCause();
            assertEquals(1, constraintViolationException.getConstraintViolations().size());
        }
    }
View Full Code Here

        for (ConstraintViolation<?> violation : constraintViolations) {
          builder.append( "\t" ).append( violation.toString() ).append("\n");
        }
        builder.append( "]" );

        throw new ConstraintViolationException(
            builder.toString(), propagatedViolations
        );
      }
    }
  }
View Full Code Here

                if (it.hasNext()) {
                    sb.append(i18n.getString("bean.validation.separator"));
                }
            }
            bean.getLock().unlock();
            throw new ConstraintViolationException(sb.toString(), constraintViolations);
        }
    }
View Full Code Here

        final ExecutableValidator methodValidator = getExecutableValidator();
        final Set< ConstraintViolation< T > > violations = methodValidator.validateParameters(instance,
            method, arguments);
       
        if (!violations.isEmpty()) {
            throw new ConstraintViolationException(violations);
        }               
    }
View Full Code Here

TOP

Related Classes of javax.validation.ConstraintViolationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.