HHH-14724 Add test for intersection types
This commit is contained in:
parent
ffd22681cd
commit
1411e7bad3
|
@ -76,14 +76,21 @@ public class CollectionAsBasicTypeTest extends CompilationTest {
|
|||
@TestForIssue(jiraKey = "HHH-12338")
|
||||
@WithClasses({PhoneBook.class})
|
||||
public void testMapType() throws ClassNotFoundException, NoSuchFieldException {
|
||||
assertMetamodelClassGeneratedFor(PhoneBook.class);
|
||||
assertMetamodelClassGeneratedFor( PhoneBook.class );
|
||||
|
||||
assertAttributeTypeInMetaModelFor(
|
||||
PhoneBook.class,
|
||||
"phones",
|
||||
PhoneBook.class.getDeclaredField("phones").getGenericType(),
|
||||
PhoneBook.class.getDeclaredField( "phones" ).getGenericType(),
|
||||
"Wrong meta model type"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-14724")
|
||||
@WithClasses({ Like.class, ConcreteLike.class })
|
||||
public void testIntersectionType() {
|
||||
assertMetamodelClassGeneratedFor( ConcreteLike.class );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.hibernate.jpamodelgen.test.collectionbasictype;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity(name = "ConcreteLike")
|
||||
public class ConcreteLike extends Like<ConcreteLike.Target> {
|
||||
|
||||
@Override
|
||||
public Reference<Target> getObject() {
|
||||
return new Reference<>();
|
||||
}
|
||||
|
||||
public static class Target implements Like.I1, Like.I2 {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.hibernate.jpamodelgen.test.collectionbasictype;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
|
||||
/**
|
||||
* @author Thomas Heigl
|
||||
*/
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
public abstract class Like<T extends Like.I1 & Like.I2> {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
public abstract Reference<T> getObject();
|
||||
|
||||
interface I1 {
|
||||
}
|
||||
|
||||
interface I2 {
|
||||
}
|
||||
|
||||
public static class Reference<T> {
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue