public void testRemove()
throws Exception
{
String[] names = new String[] { "name", "descriptorType" };
Object[] values = new Object[] { "testName", "testType" };
DescriptorSupport descriptor = new DescriptorSupport(names, values);
descriptor.removeField("name");
assertTrue("Should be one field", descriptor.getFields().length == 1);
assertTrue("name should not be present", descriptor.getFieldValue("name") == null);
assertEquals("testType", descriptor.getFieldValue("descriptorType"));
descriptor = new DescriptorSupport(names, values);
descriptor.removeField("NAME");
assertTrue("Should be one field", descriptor.getFields().length == 1);
assertTrue("name should not be present", descriptor.getFieldValue("name") == null);
assertEquals("testType", descriptor.getFieldValue("descriptorType"));
descriptor = new DescriptorSupport(names, values);
descriptor.removeField("notPresent");
assertTrue("Should be two fields", descriptor.getFields().length == 2);
assertEquals("testName", descriptor.getFieldValue("name"));
assertEquals("testType", descriptor.getFieldValue("descriptorType"));
descriptor.removeField(null);
assertTrue("Should be two fields", descriptor.getFields().length == 2);
assertEquals("testName", descriptor.getFieldValue("name"));
assertEquals("testType", descriptor.getFieldValue("descriptorType"));
descriptor.removeField("");
assertTrue("Should be two fields", descriptor.getFields().length == 2);
assertEquals("testName", descriptor.getFieldValue("name"));
assertEquals("testType", descriptor.getFieldValue("descriptorType"));
}