|
8 | 8 | import jakarta.persistence.EntityManager; |
9 | 9 | import jakarta.persistence.Id; |
10 | 10 | import jakarta.persistence.NamedQuery; |
| 11 | +import org.hibernate.processor.test.innerclass.InnerClassTest.One.Two; |
11 | 12 | import org.hibernate.processor.test.util.CompilationTest; |
12 | 13 | import org.hibernate.processor.test.util.WithClasses; |
13 | 14 | import org.junit.Test; |
|
17 | 18 | import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfFieldInMetamodelFor; |
18 | 19 | import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfMethodInMetamodelFor; |
19 | 20 | import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString; |
| 21 | +import static org.junit.Assert.assertEquals; |
20 | 22 |
|
21 | 23 | public class InnerClassTest extends CompilationTest { |
22 | 24 |
|
23 | | - @WithClasses({Person.class, Dummy.class, Inner.class}) |
| 25 | + @WithClasses({Person.class, Dummy.class, Inner.class, Two.class}) |
24 | 26 | @Test |
25 | 27 | public void test() { |
| 28 | + System.out.println( getMetaModelSourceAsString( InnerClassTest.class ) ); |
| 29 | + System.out.println( getMetaModelSourceAsString( Dummy.class ) ); |
| 30 | + System.out.println( getMetaModelSourceAsString( Person.class ) ); |
| 31 | + assertEquals( |
| 32 | + getMetaModelSourceAsString( Inner.class ), |
| 33 | + getMetaModelSourceAsString( Two.class ) |
| 34 | + ); |
26 | 35 | assertMetamodelClassGeneratedFor( Inner.class ); |
27 | | - System.out.println( getMetaModelSourceAsString( Inner.class ) ); |
| 36 | + assertMetamodelClassGeneratedFor( Two.class ); |
28 | 37 | assertMetamodelClassGeneratedFor( Dummy.Inner.class ); |
29 | | - System.out.println( getMetaModelSourceAsString( Dummy.Inner.class ) ); |
30 | 38 | assertMetamodelClassGeneratedFor( Person.class ); |
31 | | - System.out.println( getMetaModelSourceAsString( Person.class ) ); |
32 | 39 | assertMetamodelClassGeneratedFor( Person.PersonId.class ); |
33 | | - System.out.println( getMetaModelSourceAsString( Person.PersonId.class ) ); |
34 | 40 | assertNoMetamodelClassGeneratedFor( Dummy.class ); |
35 | 41 | assertMetamodelClassGeneratedFor( Dummy.DummyEmbeddable.class ); |
36 | | - System.out.println( getMetaModelSourceAsString( Dummy.DummyEmbeddable.class ) ); |
37 | 42 | assertMetamodelClassGeneratedFor( Dummy.ThePerson.class ); |
38 | | - System.out.println( getMetaModelSourceAsString( Dummy.ThePerson.class ) ); |
39 | 43 | assertPresenceOfFieldInMetamodelFor( Dummy.ThePerson.class, "QUERY_SELECT_THE_PERSON_NAME" ); |
40 | 44 | assertPresenceOfMethodInMetamodelFor( Dummy.ThePerson.class, "selectThePersonName", EntityManager.class ); |
41 | 45 | } |
@@ -64,4 +68,13 @@ public void setAddress(String address) { |
64 | 68 | this.address = address; |
65 | 69 | } |
66 | 70 | } |
| 71 | + |
| 72 | + static class One { |
| 73 | + @Entity |
| 74 | + static class Two { |
| 75 | + @Id |
| 76 | + Integer id; |
| 77 | + String value; |
| 78 | + } |
| 79 | + } |
67 | 80 | } |
0 commit comments