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

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


        final MutableNumberType numberType = TYPE_FACTORY.createNumberType();

        // normal case
        MutableNumberValue numberValue = VALUE_FACTORY.createNumberValue();
        numberValue.setValue(new Integer(5));
        Collection errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());

        // null value
        numberValue = VALUE_FACTORY.createNumberValue();
        errors = numberType.verify(numberValue);
View Full Code Here


        Collection errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());

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

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

        // invalid type
        BooleanValue booleanValue = VALUE_FACTORY.createBooleanValue();
        errors = numberType.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(new Integer(7));
        enumeratedValues.add(constraintValue.createImmutable());
        numberType.setEnumeratedConstraint(enumeratedConstraint);
        // check constraint with right value
        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Integer(8));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
View Full Code Here

        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Integer(8));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
        assertEquals("", error.getLocation());
View Full Code Here

        final ImmutableNumberSubTypeConstraint subTypeConstraint =
            CONSTRAINT_FACTORY.getNumberSubTypeConstraint(Integer.class);
        numberType.setNumberSubTypeConstraint(subTypeConstraint);
        // check constraint with right value
        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Long(8));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
View Full Code Here

        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Long(8));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
        assertEquals("", error.getLocation());
View Full Code Here

        minValueConstraint.setLimit(new Integer(6));
        minValueConstraint.setInclusive(true);
        numberType.setMinimumValueConstraint(minValueConstraint);
        // check constraint with right value
        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Integer(5));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
View Full Code Here

        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Integer(5));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
        error = (VerificationError) errors.iterator().next();
        assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
            error.getType());
        assertEquals("", error.getLocation());
View Full Code Here

        // minimum value constraint with inclusive set to false
        minValueConstraint.setInclusive(false);
        numberType.setMinimumValueConstraint(minValueConstraint);
        // check constraint with right value
        numberValue.setValue(new Integer(7));
        errors = numberType.verify(numberValue);
        assertEquals(0, errors.size());
        // check constraint violation
        numberValue.setValue(new Integer(6));
        errors = numberType.verify(numberValue);
        assertEquals(1, errors.size());
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.