Package com.volantis.shared.metadata.type.mutable

Examples of com.volantis.shared.metadata.type.mutable.MutableStringType.verify()


        final MutableStringType stringType = TYPE_FACTORY.createStringType();

        // normal case
        MutableStringValue stringValue = VALUE_FACTORY.createStringValue();
        stringValue.setValue("Foo");
        Collection errors = stringType.verify(stringValue);
        assertEquals(0, errors.size());

        // null value
        stringValue = VALUE_FACTORY.createStringValue();
        errors = stringType.verify(stringValue);
View Full Code Here


        Collection errors = stringType.verify(stringValue);
        assertEquals(0, errors.size());

        // null value
        stringValue = VALUE_FACTORY.createStringValue();
        errors = stringType.verify(stringValue);
        assertEquals(1, errors.size());
        VerificationError error =
            (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_NULL_VALUE,
            error.getType());
View Full Code Here

        assertEquals(stringValue, error.getInvalidValue());
        assertNull(error.getConstraint());

        // invalid type
        BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = stringType.verify(booleanValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_INVALID_IMPLEMENTATION,
            error.getType());
        assertEquals("", error.getLocation());
View Full Code Here

        constraintValue.setValue("two");
        enumeratedValues.add(constraintValue.createImmutable());
        stringType.setEnumeratedConstraint(enumeratedConstraint);
        // check constraint with right value
        stringValue.setValue("two");
        errors = stringType.verify(stringValue);
        assertEquals(0, errors.size());
        // check constraint violation
        stringValue.setValue("three");
        errors = stringType.verify(stringValue);
        assertEquals(1, errors.size());
View Full Code Here

        stringValue.setValue("two");
        errors = stringType.verify(stringValue);
        assertEquals(0, errors.size());
        // check constraint violation
        stringValue.setValue("three");
        errors = stringType.verify(stringValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
        assertEquals("", error.getLocation());
View Full Code Here

        stringType.setMinimumLengthConstraint(minimumLengthConstraint);

        // check constraint with right value
        final MutableStringValue stringValue = VALUE_FACTORY.createStringValue();
        stringValue.setValue("hello");
        Collection errors = stringType.verify(stringValue);
        assertEquals(0, errors.size());

        // check constraint violation
        minimumLengthConstraint.setLimit(6);
        stringType.setMinimumLengthConstraint(minimumLengthConstraint);
View Full Code Here

        assertEquals(0, errors.size());

        // check constraint violation
        minimumLengthConstraint.setLimit(6);
        stringType.setMinimumLengthConstraint(minimumLengthConstraint);
        errors = stringType.verify(stringValue);
        assertEquals(1, errors.size());
        final Iterator iter = errors.iterator();
        VerificationError error = (VerificationError) iter.next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
View Full Code Here

        stringType.setMaximumLengthConstraint(maximumLengthConstraint);

        // check constraint with right value
        final MutableStringValue stringValue = VALUE_FACTORY.createStringValue();
        stringValue.setValue("hello");
        Collection errors = stringType.verify(stringValue);
        assertEquals(0, errors.size());

        // check constraint violation
        maximumLengthConstraint.setLimit(4);
        stringType.setMaximumLengthConstraint(maximumLengthConstraint);
View Full Code Here

        assertEquals(0, errors.size());

        // check constraint violation
        maximumLengthConstraint.setLimit(4);
        stringType.setMaximumLengthConstraint(maximumLengthConstraint);
        errors = stringType.verify(stringValue);
        assertEquals(1, errors.size());
        final Iterator iter = errors.iterator();
        VerificationError error = (VerificationError) iter.next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.