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

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


    public void testVerifyImplementation() {
        final MutableChoiceType choiceType =
            TYPE_FACTORY.createChoiceType();

        // normal case
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
        Collection errors = choiceType.verify(choiceValue);
        assertEquals(0, errors.size());

        // invalid type
View Full Code Here


            TYPE_FACTORY.createChoiceDefinition("foo");
        choiceDefinition.setType(TYPE_FACTORY.createStringType());
        choiceDefinitions.add(choiceDefinition);       
   
        // set up the value structure
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
       
        choiceValue.setChoiceName("foo");
        final MutableStringValue fooValue = VALUE_FACTORY.createStringValue();
        fooValue.setValue("Foo");
        choiceValue.setValue(fooValue);

        final Collection errors = choiceType.verify(choiceValue);
        assertEquals(0, errors.size());
    }
View Full Code Here

            TYPE_FACTORY.createChoiceDefinition("foo");
        choiceDefinition.setType(TYPE_FACTORY.createStringType());
        choiceDefinitions.add(choiceDefinition);       
   
        // set up the value structure
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
       
        choiceValue.setChoiceName("bar");

        final Collection errors = choiceType.verify(choiceValue);
        assertEquals(1, errors.size());
    }
View Full Code Here

            TYPE_FACTORY.createChoiceDefinition("foo");
        choiceDefinition.setType(TYPE_FACTORY.createStringType());
        choiceDefinitions.add(choiceDefinition);       
   
        // set up the value structure
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
       
        final Collection errors = choiceType.verify(choiceValue);
        assertEquals(1, errors.size());
    }
View Full Code Here

        final MutableStringType stringType = TYPE_FACTORY.createStringType();
        choiceDefinition.setType(stringType);
        choiceDefinitions.add(choiceDefinition);

        // set up the value strucutre
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
        choiceValue.setChoiceName("foo");
        final MutableStringValue fooValue = VALUE_FACTORY.createStringValue();
        fooValue.setValue("Foo");
        choiceValue.setValue(fooValue);

        final Collection errors = choiceType.verify(choiceValue);
        assertEquals(0, errors.size());
    }
View Full Code Here

        final MutableStringType stringType = TYPE_FACTORY.createStringType();
        choiceDefinition.setType(stringType);
        choiceDefinitions.add(choiceDefinition);

        // set up the value strucutre
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
        choiceValue.setChoiceName("foo");
        final MutableNumberValue fooValue = VALUE_FACTORY.createNumberValue();
        fooValue.setValue(new Integer(1));
        choiceValue.setValue(fooValue);

        final Collection errors = choiceType.verify(choiceValue);
        assertEquals(1, errors.size());
    }
View Full Code Here

        final MutableStringType stringType = TYPE_FACTORY.createStringType();
        choiceDefinition.setType(stringType);
        choiceDefinitions.add(choiceDefinition);

        // set up the value strucutre
        final MutableChoiceValue choiceValue =
            VALUE_FACTORY.createChoiceValue();
        choiceValue.setChoiceName("foo");

        final Collection errors = choiceType.verify(choiceValue);
        assertEquals(1, errors.size());
    }
View Full Code Here

    }

     // Javadoc inherited.
    public void testEqualsAndHashcodeImplementedCorrectly() {

        MutableChoiceValue choiceValue1 = createMutableChoiceValueForTestingEquals();
        MutableChoiceValue choiceValue2 = createMutableChoiceValueForTestingEquals();

        // test that both the values are equal and they have the same hash codes
        assertEquals("Object 1 should be equal to object 2", choiceValue1,
                choiceValue2);
        MetaDataTestCaseHelper.ensureHashcodesEqual(choiceValue1, choiceValue2);

        // change the value
        final MutableNumberValueImpl value = new MutableNumberValueImpl();
        value.setValue(new Integer(123));
        choiceValue2.setValue(value);
        MetaDataTestCaseHelper.assertNotEquals(choiceValue1, choiceValue2);
        MetaDataTestCaseHelper.ensureHashcodesNotEqual(choiceValue1, choiceValue2);

        // now reset
        choiceValue2 = createMutableChoiceValueForTestingEquals();

        // change the choice name
        choiceValue2.setChoiceName("other");
        MetaDataTestCaseHelper.assertNotEquals(choiceValue1, choiceValue2);
        MetaDataTestCaseHelper.ensureHashcodesNotEqual(choiceValue1, choiceValue2);
    }
View Full Code Here

     * be used for testing.
     *
     * @return a mutable unit type.
     */
    private MutableChoiceValue createMutableChoiceValueForTestingEquals() {
        MutableChoiceValue mutableChoiceValue = new MutableChoiceValueImpl();

        mutableChoiceValue.setChoiceName("dummy");

        MutableNumberValueImpl value = new MutableNumberValueImpl();
        value.setValue(new Integer(1));
        mutableChoiceValue.setValue(value);

        return mutableChoiceValue;
    }
View Full Code Here

TOP

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

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.