public void testCaseInsensitiveFieldsStruct() throws Exception {
OrcStruct struct = new OrcStruct(Lists.newArrayList(FIELD_0));
struct.setFieldValue(0, new Text("a"));
// Test control case (cases match)
StructField field = NON_LAZY_STRUCT_OI.getStructFieldRef(FIELD_0);
Assert.assertEquals("a",
((StringObjectInspector) field.getFieldObjectInspector()).getPrimitiveJavaObject(
NON_LAZY_STRUCT_OI.getStructFieldData(struct, field)));
// Test upper case
field = NON_LAZY_STRUCT_OI.getStructFieldRef(FIELD_0.toUpperCase());
Assert.assertEquals("a",
((StringObjectInspector) field.getFieldObjectInspector()).getPrimitiveJavaObject(
NON_LAZY_STRUCT_OI.getStructFieldData(struct, field)));
// Test lower case (even if someone changes the value of FIELD_0 in the future either upper
// or lower case should be different from the actual case)
field = NON_LAZY_STRUCT_OI.getStructFieldRef(FIELD_0.toLowerCase());
Assert.assertEquals("a",
((StringObjectInspector) field.getFieldObjectInspector()).getPrimitiveJavaObject(
NON_LAZY_STRUCT_OI.getStructFieldData(struct, field)));
}