Package com.volantis.shared.metadata.value.mutable

Examples of com.volantis.shared.metadata.value.mutable.MutableCollectionValue


    public void testVerify() {
        final MetaDataType collectionType = (MetaDataType) getMutableInhibitor();

        // normal case
        final MutableCollectionValue collectionValue =
            createCollectionValue(new String[]{"one", "two"});
        Collection errors = collectionType.verify(collectionValue);
        assertEquals(0, errors.size());

        // invalid type
View Full Code Here


            CONSTRAINT_FACTORY.createMemberTypeConstraint();
        memberTypeConstraint.setMemberType(TYPE_FACTORY.createStringType());
        collectionType.setMemberTypeConstraint(memberTypeConstraint);

        // check constraint with right value
        final MutableCollectionValue collectionValue =
            createCollectionValue(new String[]{"one", "two"});
        Collection errors = collectionType.verify(collectionValue);
        assertEquals(0, errors.size());

        // check constraint violation
View Full Code Here

            CONSTRAINT_FACTORY.createMinimumLengthConstraint();
        minimumLengthConstraint.setLimit(2);
        collectionType.setMinimumLengthConstraint(minimumLengthConstraint);

        // check constraint with right value
        final MutableCollectionValue collectionValue =
            createCollectionValue(new String[]{"one", "two"});
        Collection errors = collectionType.verify(collectionValue);
        assertEquals(0, errors.size());

        // check constraint violation
View Full Code Here

            CONSTRAINT_FACTORY.createMaximumLengthConstraint();
        maximumLengthConstraint.setLimit(2);
        collectionType.setMaximumLengthConstraint(maximumLengthConstraint);

        // check constraint with right value
        final MutableCollectionValue collectionValue =
            createCollectionValue(new String[]{"one", "two"});
        Collection errors = collectionType.verify(collectionValue);
        assertEquals(0, errors.size());

        // check constraint violation
View Full Code Here

        assertEquals(collectionValue, error.getInvalidValue());
        assertEquals(maximumLengthConstraint, error.getConstraint());
    }

    protected MutableCollectionValue createCollectionValue(final String[] values) {
        MutableCollectionValue collectionValue = createEmptyValue();
        final Collection contents =
            collectionValue.getContentsAsMutableCollection();
        for (int i = 0; i < values.length; i++) {
            final MutableStringValue stringValue =
                VALUE_FACTORY.createStringValue();
            stringValue.setValue(values[i]);
            contents.add(stringValue);
View Full Code Here

     * Test which ensures that when {@link CollectionValue#getContentsAsCollection} is
     * called on a {@link MutableCollectionValue} then the returned {@link Collection} is
     * immutable.
     */
    public void testGetContentsAsCollectionReturnsImmutableCollectionOnMutable(){
        MutableCollectionValue mutableCollection = (MutableCollectionValue)
                getMutableInhibitor();
        Collection collection = mutableCollection.getContentsAsCollection();
        doImmutableCollectionTest(collection);
    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.metadata.value.mutable.MutableCollectionValue

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.