Re-enabled additional tets

This commit is contained in:
Andrea Boriero 2021-10-14 17:42:30 +02:00
parent ad5326a8ce
commit f02ffde061
2 changed files with 67 additions and 23 deletions

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.test.bytecode.enhancement.lazy.proxy;
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import java.util.Map;
import jakarta.persistence.Entity;
@ -116,21 +116,44 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatefulTest extends BaseNonC
final OtherEntity otherEntity = session.get( OtherEntity.class, "test1" );
assertTrue( Hibernate.isPropertyInitialized( otherEntity, "animal" ) );
assertTrue( Hibernate.isInitialized( otherEntity.animal ) );
assertFalse( HibernateProxy.class.isInstance( otherEntity.animal ) );
/*
The original test used
@Tuplizer(impl=NoProxyFactoryPojoEntityTuplizer.class)
public static abstract class Animal {
}
this is not supported anymore, so the test expectation changed
*/
// assertTrue( Hibernate.isInitialized( otherEntity.animal ) );
// assertFalse( HibernateProxy.class.isInstance( otherEntity.animal ) );
assertFalse( Hibernate.isInitialized( otherEntity.animal ) );
assertTrue( HibernateProxy.class.isInstance( otherEntity.animal ) );
assertTrue( Hibernate.isPropertyInitialized( otherEntity, "primate" ) );
assertTrue( Hibernate.isInitialized( otherEntity.primate ) );
assertFalse( HibernateProxy.class.isInstance( otherEntity.primate ) );
// assertTrue( Hibernate.isInitialized( otherEntity.primate ) );
// assertFalse( HibernateProxy.class.isInstance( otherEntity.primate ) );
assertFalse( Hibernate.isInitialized( otherEntity.primate ) );
assertTrue( HibernateProxy.class.isInstance( otherEntity.primate ) );
assertTrue( Hibernate.isPropertyInitialized( otherEntity, "human" ) );
assertTrue( Hibernate.isInitialized( otherEntity.human ) );
assertFalse( HibernateProxy.class.isInstance( otherEntity.human ) );
assertSame( otherEntity.human, otherEntity.animal );
assertSame( otherEntity.human, otherEntity.primate );
assertEquals( 2, stats.getPrepareStatementCount() );
// assertTrue( Hibernate.isInitialized( otherEntity.human ) );
// assertFalse( HibernateProxy.class.isInstance( otherEntity.human ) );
assertFalse( Hibernate.isInitialized( otherEntity.human ) );
assertTrue( HibernateProxy.class.isInstance( otherEntity.human ) );
// assertSame( otherEntity.human, otherEntity.animal );
// assertSame( otherEntity.human, otherEntity.primate );
// assertEquals( 2, stats.getPrepareStatementCount() );
assertEquals( 1, stats.getPrepareStatementCount() );
}
);
assertEquals( 2, stats.getPrepareStatementCount() );
// assertEquals( 2, stats.getPrepareStatementCount() );
assertEquals( 1, stats.getPrepareStatementCount() );
}
@Test
@ -150,7 +173,6 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatefulTest extends BaseNonC
session -> {
final Statistics stats = sessionFactory().getStatistics();
stats.clear();
final OtherEntity otherEntity = session.get( OtherEntity.class, "test1" );
assertNull( otherEntity.animal );
assertNull( otherEntity.primate );

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.test.bytecode.enhancement.lazy.proxy;
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import java.util.Map;
import jakarta.persistence.Entity;
@ -117,21 +117,43 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatelessTest extends BaseNon
final OtherEntity otherEntity = (OtherEntity) session.get( OtherEntity.class, "test1" );
assertTrue( Hibernate.isPropertyInitialized( otherEntity, "animal" ) );
assertTrue( Hibernate.isInitialized( otherEntity.animal ) );
assertFalse( HibernateProxy.class.isInstance( otherEntity.animal ) );
/*
The original test used
@Tuplizer(impl=NoProxyFactoryPojoEntityTuplizer.class)
public static abstract class Animal {
}
this is not supported anymore, so the test expectation changed
*/
// assertTrue( Hibernate.isInitialized( otherEntity.animal ) );
// assertFalse( HibernateProxy.class.isInstance( otherEntity.animal ) );
assertFalse( Hibernate.isInitialized( otherEntity.animal ) );
assertTrue( HibernateProxy.class.isInstance( otherEntity.animal ) );
assertTrue( Hibernate.isPropertyInitialized( otherEntity, "primate" ) );
assertTrue( Hibernate.isInitialized( otherEntity.primate ) );
assertFalse( HibernateProxy.class.isInstance( otherEntity.primate ) );
// assertTrue( Hibernate.isInitialized( otherEntity.primate ) );
// assertFalse( HibernateProxy.class.isInstance( otherEntity.primate ) );
assertFalse( Hibernate.isInitialized( otherEntity.primate ) );
assertTrue( HibernateProxy.class.isInstance( otherEntity.primate ) );
assertTrue( Hibernate.isPropertyInitialized( otherEntity, "human" ) );
assertTrue( Hibernate.isInitialized( otherEntity.human ) );
assertFalse( HibernateProxy.class.isInstance( otherEntity.human ) );
assertSame( otherEntity.human, otherEntity.animal );
assertSame( otherEntity.human, otherEntity.primate );
assertEquals( 2, stats.getPrepareStatementCount() );
// assertTrue( Hibernate.isInitialized( otherEntity.human ) );
// assertFalse( HibernateProxy.class.isInstance( otherEntity.human ) );
assertFalse( Hibernate.isInitialized( otherEntity.human ) );
assertTrue( HibernateProxy.class.isInstance( otherEntity.human ) );
// assertSame( otherEntity.human, otherEntity.animal );
// assertSame( otherEntity.human, otherEntity.primate );
// assertEquals( 2, stats.getPrepareStatementCount() );
assertEquals( 1, stats.getPrepareStatementCount() );
}
);
assertEquals( 2, stats.getPrepareStatementCount() );
// assertEquals( 2, stats.getPrepareStatementCount() );
assertEquals( 1, stats.getPrepareStatementCount() );
}
@Test