Examples of MutableNumberSubTypeConstraint


Examples of com.volantis.shared.metadata.type.constraint.mutable.MutableNumberSubTypeConstraint

    }

    // Javadoc inherited.
    public void testEqualsAndHashcodeImplementedCorrectly() {

         MutableNumberSubTypeConstraint subTypeConstraint1 =
                createMutableNumberSubTypeConstraint();
        MutableNumberSubTypeConstraint subTypeConstraint2 =
                createMutableNumberSubTypeConstraint();

        // test that both the values are equal and they have the same hash codes
        assertEquals("Object 1 should be equal to object 2", subTypeConstraint1,
                subTypeConstraint2);

        int subTypeConstraint1Hashcode = subTypeConstraint1.hashCode();
        int subTypeConstraint2Hashcode = subTypeConstraint2.hashCode();
        assertTrue("Objects which are equal should have the same hash codes. Were : "
                + subTypeConstraint1Hashcode + " and " + subTypeConstraint2Hashcode,
                subTypeConstraint1Hashcode == subTypeConstraint2Hashcode);

        subTypeConstraint2.setNumberSubType(Integer.class);

        assertNotEquals(subTypeConstraint1, subTypeConstraint2);
        assertNotEquals(subTypeConstraint2, subTypeConstraint1);

        // ensure that the hashcodes are different for these two objects
        subTypeConstraint1Hashcode = subTypeConstraint1.hashCode();
        subTypeConstraint2Hashcode = subTypeConstraint2.hashCode();
        assertFalse("Objects which are not equal should ideally have different hash codes",
                subTypeConstraint1Hashcode == subTypeConstraint2Hashcode);

    }
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.