METAGEN-79 TestUtil#getFieldFromMetamodelFor() used now Class.getDeclaredField() to only access fields defined in the actual class

This commit is contained in:
Hardy Ferentschik 2012-01-20 11:57:18 +01:00 committed by Strong Liu
parent 2d245a3798
commit 4ac9cbfdb3
2 changed files with 8 additions and 2 deletions

View File

@ -42,10 +42,16 @@ public class InheritanceTest extends CompilationTest {
// METAGEN-29
assertSuperClassRelationShipInMetamodel( Person.class, AbstractEntity.class );
assertPresenceOfFieldInMetamodelFor( AbstractEntity.class, "id", "Property 'id' should exist" );
assertPresenceOfFieldInMetamodelFor( AbstractEntity.class, "foo", "Property should exist - METAGEN-29" );
assertAttributeTypeInMetaModelFor(
AbstractEntity.class, "foo", Object.class, "Object is the upper bound of foo "
AbstractEntity.class,
"foo",
Object.class,
"Object is the upper bound of foo "
);
assertPresenceOfFieldInMetamodelFor( Person.class, "name", "Property 'name' should exist" );
}
@Override

View File

@ -211,7 +211,7 @@ public class TestUtil {
Class<?> metaModelClass = getMetamodelClassFor( entityClass );
Field field;
try {
field = metaModelClass.getField( fieldName );
field = metaModelClass.getDeclaredField( fieldName );
}
catch ( NoSuchFieldException e ) {
field = null;