@Test
public void testGetNamesOfIdPropertiesFromAClassHierarchyHavingAMethodAnnotatedWithId() throws Exception {

    // GIVEN
    final String simpleClassNameBase = "EntityClass";
    final String simpleClassNameB = "SubEntityClass";
    final String idPropertyName = "key";
    final JPackage jp = jCodeModel.rootPackage();
    final JDefinedClass jBaseClass = jp._class(JMod.PUBLIC, simpleClassNameBase);
    jBaseClass.annotate(Entity.class);
    jBaseClass.annotate(Inheritance.class).param("strategy", InheritanceType.TABLE_PER_CLASS);
    jBaseClass.method(JMod.PUBLIC, jCodeModel.VOID, "getKey").annotate(Id.class);
    final JDefinedClass jSubclass = jp._class(JMod.PUBLIC, simpleClassNameB)._extends(jBaseClass);
    jSubclass.annotate(Entity.class);
    buildModel(testFolder.getRoot(), jCodeModel);
    compileModel(testFolder.getRoot());
    final Class<?> subClass = loadClass(testFolder.getRoot(), jSubclass.name());
    // WHEN
    final List<String> namesOfIdProperties = EntityUtils.getNamesOfIdProperties(subClass);
    // THEN
    assertThat(namesOfIdProperties.size(), equalTo(1));
    assertThat(namesOfIdProperties, hasItem(idPropertyName));
}