String[] itemNames = initKeys();
MetaValue[] itemValues = initValues();
try
{
new CompositeValueSupport(null, itemNames, itemValues);
fail("Excepted IllegalArgumentException for null composite type");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, null, itemValues);
fail("Excepted IllegalArgumentException for null item names");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, new String[0], itemValues);
fail("Excepted IllegalArgumentException for empty item names");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, itemNames, null);
fail("Excepted IllegalArgumentException for null item values");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, itemNames, new MetaValue[0]);
fail("Excepted IllegalArgumentException for empty item values");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, new String[] { "name1", null }, itemValues);
fail("Excepted IllegalArgumentException for a null item name");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, new String[] { "name1", "" }, itemValues);
fail("Excepted IllegalArgumentException for an empty item name");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, itemNames, new MetaValue[] { initStringWrong() });
fail("Excepted IllegalArgumentException for mismatch in number of itemNames/itemValues");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, new String[] { "name1", "wrongName" }, itemValues);
fail("Excepted IllegalArgumentException for an item name not in the composite type");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
try
{
new CompositeValueSupport(compositeMetaType, itemNames, new MetaValue[] { initStringValue1(), initStringWrong() });
fail("Excepted IllegalArgumentException for an item value of the wrong type");
}
catch (Throwable t)
{
checkThrowable(IllegalArgumentException.class, t);
}
new CompositeValueSupport(compositeMetaType, itemNames, new MetaValue[] { initStringValue1(), null });
new CompositeValueSupport(compositeMetaType, itemNames, new MetaValue[] { initStringValue1(), initIntegerNull() });
}