public void testCreateEnumElementValue() throws Exception
{
final ClassGen cg = createClassGen("HelloWorld");
final ConstantPoolGen cp = cg.getConstantPool();
final ObjectType enumType = new ObjectType("SimpleEnum"); // Supports rainbow
final EnumElementValueGen evg = new EnumElementValueGen(enumType, "Red", cp);
assertTrue(
"The new ElementValue value index should match the contents of the constantpool but "
+ evg.getValueIndex() + "!=" + cp.lookupUtf8("Red"),
evg.getValueIndex() == cp.lookupUtf8("Red"));
checkSerialize(evg, cp);
}
|