public void testNineParameCtor() throws Exception
{
Float defaultvalue = new Float(1.00);
Float minvalue = new Float(0.75);
Float maxvalue = new Float(1.50);
OpenMBeanAttributeInfoSupport info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
defaultvalue,
minvalue,
maxvalue);
assertTrue("Null info constructed", info != null);
assertTrue("Expecting min value of 0.75",
info.hasMinValue() && minvalue.equals((Float)info.getMinValue()));
assertTrue("Expecting max value of 1.50",
info.hasMaxValue() && maxvalue.equals((Float)info.getMaxValue()));
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
defaultvalue,
null,
maxvalue);
assertTrue("Null info constructed", info != null);
assertFalse("Not expecting a min value",
info.hasMinValue());
assertTrue("Expecting max value of 1.50",
info.hasMaxValue() && maxvalue.equals((Float)info.getMaxValue()));
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
defaultvalue,
minvalue,
null);
assertTrue("Null info constructed", info != null);
assertTrue("Expecting min value of 0.75",
info.hasMinValue() && minvalue.equals((Float)info.getMinValue()));
assertFalse("Not expecting a max value",
info.hasMaxValue());
try
{
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
"1.00",
minvalue,
maxvalue);
fail("Expecting exception for bad default value type");
}
catch (OpenDataException x)
{
assertTrue(true);
}
try
{
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
defaultvalue,
"0.75",
maxvalue);
fail("Expecting exception for bad min value type");
}
catch (OpenDataException x)
{
assertTrue(true);
}
try
{
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
defaultvalue,
minvalue,
"1.50");
fail("Expecting exception for bad min value type");
}
catch (OpenDataException x)
{
assertTrue(true);
}
try
{
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
new ArrayType(1, SimpleType.FLOAT),
true,
false,
false,
defaultvalue,
minvalue,
maxvalue);
fail("Expecting exception for non-null default value w/ArrayType attribute");
}
catch (OpenDataException x)
{
assertTrue(true);
}
try
{
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,
defaultvalue,
maxvalue,
minvalue);
fail("Expecting exception for min > max");
}
catch (OpenDataException x)
{
assertTrue(true);
}
try
{
info =
new OpenMBeanAttributeInfoSupport("price",
"how much it costs",
SimpleType.FLOAT,
true,
false,
false,