HHH-14220 Skip test when bytecode provider is Javassist

This commit is contained in:
Andrea Boriero 2020-09-28 17:54:31 +01:00 committed by Sanne Grinovero
parent f2a742e3c4
commit a64f193fae
1 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import javax.persistence.MappedSuperclass;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Environment;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.CustomEnhancementContext;
@ -35,6 +36,8 @@ import org.junit.runner.RunWith;
@CustomEnhancementContext({ DirtyCheckEnhancementContext.class })
public class DirtyCheckPrivateUnMappedCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
boolean skipTest;
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
@ -45,11 +48,21 @@ public class DirtyCheckPrivateUnMappedCollectionTest extends BaseNonConfigCoreFu
@Override
protected void applyMetadataSources(MetadataSources sources) {
sources.addAnnotatedClass( Measurement.class );
String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER );
if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) {
// skip the test if the bytecode provider is Javassist
skipTest = true;
}
else {
sources.addAnnotatedClass( Measurement.class );
}
}
@Test
public void testIt() {
if ( skipTest ) {
return;
}
inTransaction(
session -> {
Tag tag = new Tag();