// Tests ---------------------------------------------------------------------
public void testOpenMBeanParameterInfoSupport()
throws Exception
{
OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING, "default");
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
assertEquals("default", info.getDefaultValue());
assertEquals(true, info.hasDefaultValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING, null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(false, info.hasDefaultValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, new Integer(3), new Integer(2), new Integer(4));
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(new Integer(3), info.getDefaultValue());
assertEquals(new Integer(2), info.getMinValue());
assertEquals(new Integer(4), info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, null, new Integer(2), new Integer(4));
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(new Integer(2), info.getMinValue());
assertEquals(new Integer(4), info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, new Integer(3), null, new Integer(4));
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(new Integer(3), info.getDefaultValue());
assertEquals(null, info.getMinValue());
assertEquals(new Integer(4), info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, new Integer(3), new Integer(2), null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(new Integer(3), info.getDefaultValue());
assertEquals(new Integer(2), info.getMinValue());
assertEquals(null, info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, null, null, new Integer(4));
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(null, info.getMinValue());
assertEquals(new Integer(4), info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, null, new Integer(2), null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(new Integer(2), info.getMinValue());
assertEquals(null, info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, new Integer(3), null, null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(new Integer(3), info.getDefaultValue());
assertEquals(null, info.getMinValue());
assertEquals(null, info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.INTEGER, null, null, null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.Integer", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(null, info.getMinValue());
assertEquals(null, info.getMaxValue());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING, "default",
new Object[] { "legal1", "legal2", "default" });
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
assertEquals("default", info.getDefaultValue());
assertEquals(3, info.getLegalValues().size());
assertTrue("legal1 should be a legal value", info.getLegalValues().contains("legal1"));
assertTrue("legal2 should be a legal value", info.getLegalValues().contains("legal2"));
assertTrue("default should be a legal value", info.getLegalValues().contains("default"));
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING, null,
new Object[] { "legal1", "legal2", "default" });
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(3, info.getLegalValues().size());
assertTrue("legal1 should be a legal value", info.getLegalValues().contains("legal1"));
assertTrue("legal2 should be a legal value", info.getLegalValues().contains("legal2"));
assertTrue("default should be a legal value", info.getLegalValues().contains("default"));
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING, "default", null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
assertEquals("default", info.getDefaultValue());
assertEquals(null, info.getLegalValues());
info = new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING, null, null);
assertEquals("name", info.getName());
assertEquals("description", info.getDescription());
assertEquals("java.lang.String", info.getType());
assertEquals(null, info.getDefaultValue());
assertEquals(null, info.getLegalValues());
}