Package com.force.sdk.jpa.beanvalidation.entities

Examples of com.force.sdk.jpa.beanvalidation.entities.BeanValidationEntity


     * @userStory xyz
     * @expectedResults Correct ConstraintViolationException is thrown.
     */
    public void testNotNull() {
        try {
            BeanValidationEntity bve = new BeanValidationEntity();
            bve.setName(null);
            em.persist(bve);
            Assert.fail("@NotNull constraint was violated.");
        } catch (ConstraintViolationException cve) {
            Assert.assertEquals(cve.getConstraintViolations().size(), 1, "Wrong number of constraint violations.");
            ConstraintViolation<?> cv = cve.getConstraintViolations().iterator().next();
View Full Code Here


     * @userStory xyz
     * @expectedResults Correct ConstraintViolationException is thrown.
     */
    public void testSize() {
        try {
            BeanValidationEntity bve = new BeanValidationEntity();
            bve.setName("ab"); // constraint require 3 characters
            em.persist(bve);
            Assert.fail("@Size constraint was violated.");
        } catch (ConstraintViolationException cve) {
            Assert.assertEquals(cve.getConstraintViolations().size(), 1, "Wrong number of constraint violations.");
            ConstraintViolation<?> cv = cve.getConstraintViolations().iterator().next();
View Full Code Here

     * @userStory xyz
     * @expectedResults Correct ConstraintViolationException is thrown.
     */
    public void testNotNull() {
        try {
            BeanValidationEntity bve = new BeanValidationEntity();
            bve.setName(null);
            entityManager.persist(bve);
            entityManager.flush();
            Assert.fail("@NotNull constraint was violated.");
        } catch (ConstraintViolationException cve) {
            Assert.assertEquals(cve.getConstraintViolations().size(), 1, "Wrong number of constraint violations.");
View Full Code Here

     * @userStory xyz
     * @expectedResults Correct ConstraintViolationException is thrown.
     */
    public void testSize() {
        try {
            BeanValidationEntity bve = new BeanValidationEntity();
            bve.setName("ab");
            entityManager.persist(bve);
            entityManager.flush();
            Assert.fail("@Size constraint was violated.");
        } catch (ConstraintViolationException cve) {
            Assert.assertEquals(cve.getConstraintViolations().size(), 1, "Wrong number of constraint violations.");
View Full Code Here

TOP

Related Classes of com.force.sdk.jpa.beanvalidation.entities.BeanValidationEntity

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.