OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
boolean caught = false;
try
{
new CompositeType(null, "description", itemNames, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null typeName");
caught = false;
try
{
new CompositeType("", "description", itemNames, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for empty typeName");
caught = false;
try
{
new CompositeType("typeName", null, itemNames, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null description");
caught = false;
try
{
new CompositeType("typeName", "", itemNames, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for empty description");
caught = false;
try
{
new CompositeType("typeName", "description", null, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null item names");
caught = false;
try
{
new CompositeType("typeName", "description", itemNames, null, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null item descriptions");
caught = false;
try
{
new CompositeType("typeName", "description", itemNames, itemDescriptions, null);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null item types");
String[] nullItemNames = new String[] { "name1", null };
caught = false;
try
{
new CompositeType("typeName", "description", nullItemNames, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null element of item names");
String[] nullItemDescriptions = new String[] { "desc1", null };
caught = false;
try
{
new CompositeType("typeName", "description", itemNames, nullItemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null element of item descriptions");
OpenType[] nullItemTypes = new OpenType[] { SimpleType.STRING, null };
caught = false;
try
{
new CompositeType("typeName", "description", itemNames, itemDescriptions, nullItemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for null element of item types");
String[] wrongItemNames = new String[] { "name1" };
caught = false;
try
{
new CompositeType("typeName", "description", wrongItemNames, itemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for wrong number of elements for item names");
String[] wrongItemDescriptions = new String[] { "desc1"};
caught = false;
try
{
new CompositeType("typeName", "description", itemNames, wrongItemDescriptions, itemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for wrong number of elements for item descriptions");
OpenType[] wrongItemTypes = new OpenType[] { SimpleType.STRING };
caught = false;
try
{
new CompositeType("typeName", "description", itemNames, itemDescriptions, wrongItemTypes);
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Excepted IllegalArgumentException for wrong number of elements for item types");
String[] duplicateItemNames = new String[] { "desc1", "desc1" };
caught = false;
try
{
new CompositeType("typeName", "description", duplicateItemNames, itemDescriptions, itemTypes);
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == false)
fail("Excepted OpenDataException for duplicate item names");
duplicateItemNames = new String[] { "desc1", " desc1 " };
caught = false;
try
{
new CompositeType("typeName", "description", duplicateItemNames, itemDescriptions, itemTypes);
}
catch (OpenDataException e)
{
caught = true;
}