* Test the degree checkers.
*/
public void testCheckDegrees()
{
// Create the role info
RoleInfo roleInfo = null;
try
{
roleInfo = new RoleInfo("RoleName", RelationSupport.class.getName(),
false, false, 23, 25, "Description");
}
catch (Exception e)
{
fail(e.toString());
}
assertEquals(true, roleInfo.checkMaxDegree(0));
assertEquals(true, roleInfo.checkMaxDegree(22));
assertEquals(true, roleInfo.checkMaxDegree(23));
assertEquals(true, roleInfo.checkMaxDegree(24));
assertEquals(true, roleInfo.checkMaxDegree(25));
assertEquals(false, roleInfo.checkMaxDegree(26));
assertEquals(false, roleInfo.checkMaxDegree(Integer.MAX_VALUE));
assertEquals(false, roleInfo.checkMinDegree(0));
assertEquals(false, roleInfo.checkMinDegree(22));
assertEquals(true, roleInfo.checkMinDegree(23));
assertEquals(true, roleInfo.checkMinDegree(24));
assertEquals(true, roleInfo.checkMinDegree(25));
assertEquals(true, roleInfo.checkMinDegree(26));
assertEquals(true, roleInfo.checkMinDegree(Integer.MAX_VALUE));
try
{
roleInfo = new RoleInfo("RoleName", RelationSupport.class.getName(),
false, false, 25,
RoleInfo.ROLE_CARDINALITY_INFINITY, "Description");
}
catch (Exception e)
{
fail(e.toString());
}
assertEquals(true, roleInfo.checkMaxDegree(0));
assertEquals(true, roleInfo.checkMaxDegree(24));
assertEquals(true, roleInfo.checkMaxDegree(25));
assertEquals(true, roleInfo.checkMaxDegree(26));
assertEquals(true, roleInfo.checkMaxDegree(Integer.MAX_VALUE));
assertEquals(false, roleInfo.checkMinDegree(0));
assertEquals(false, roleInfo.checkMinDegree(24));
assertEquals(true, roleInfo.checkMinDegree(25));
assertEquals(true, roleInfo.checkMinDegree(26));
assertEquals(true, roleInfo.checkMinDegree(Integer.MAX_VALUE));
try
{
roleInfo = new RoleInfo("RoleName", RelationSupport.class.getName(),
false, false, RoleInfo.ROLE_CARDINALITY_INFINITY,
RoleInfo.ROLE_CARDINALITY_INFINITY, "Description");
}
catch (Exception e)
{
fail(e.toString());
}
assertEquals(true, roleInfo.checkMaxDegree(0));
assertEquals(true, roleInfo.checkMaxDegree(26));
assertEquals(true, roleInfo.checkMaxDegree(Integer.MAX_VALUE));
assertEquals(true, roleInfo.checkMinDegree(0));
assertEquals(true, roleInfo.checkMinDegree(24));
assertEquals(true, roleInfo.checkMinDegree(Integer.MAX_VALUE));
}