boolean caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
null, "description", parms,
SimpleType.STRING, MBeanOperationInfo.ACTION_INFO);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for null name");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"", "description", parms,
SimpleType.STRING, MBeanOperationInfo.ACTION_INFO);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for empty name");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"name", null, parms,
SimpleType.STRING, MBeanOperationInfo.ACTION_INFO);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for null description");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"name", "", parms,
SimpleType.STRING, MBeanOperationInfo.ACTION_INFO);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for empty description");
caught = false;
try
{
new OpenMBeanOperationInfoSupport(
"name", "description", new MyOpenMBeanParameterInfo[] { new MyOpenMBeanParameterInfo() },
SimpleType.STRING, MBeanOperationInfo.ACTION_INFO);
}
catch (ArrayStoreException e)
{
caught = true;
}
if (caught == false)
fail("Expected ArrayStoreException for non MBeanParameterInfo array");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"name", "description", parms,
null, MBeanOperationInfo.ACTION_INFO);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for null return type");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"name", "description", parms,
SimpleType.VOID, MBeanOperationInfo.ACTION_INFO);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == true)
fail("Didn't expect IllegalArgumentException for VOID return type");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"name", "description", parms,
SimpleType.STRING, 1234567);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentExecption for invalid action");
caught = false;
try
{
OpenMBeanParameterInfoSupport[] parms = new OpenMBeanParameterInfoSupport[]
{
new OpenMBeanParameterInfoSupport(
"name", "description", SimpleType.STRING)
};
new OpenMBeanOperationInfoSupport(
"name", "description", parms,
SimpleType.STRING, MBeanOperationInfo.UNKNOWN);