HHH-14828 Disable bytecode enhancement test on final fields for javassist

This commit is contained in:
Yoann Rodière 2021-10-19 08:32:00 +02:00
parent 108a664c75
commit 2fbfaa63bc
No known key found for this signature in database
GPG Key ID: B8D049359DC35ABC
1 changed files with 13 additions and 0 deletions

View File

@ -19,9 +19,13 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.Immutable;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Environment;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -37,6 +41,15 @@ public class FinalFieldEnhancementTest extends BaseCoreFunctionalTestCase {
};
}
@Before
public void checkBytebuddy() {
String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER );
// skip the test if the bytecode provider is Javassist
Assume.assumeTrue( "This test will only pass with Bytebuddy bytecode enhancement (currently using '"
+ byteCodeProvider + "')",
byteCodeProvider == null || Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) );
}
@Test
public void entityWithFinalField_constructor() {
EntityWithFinalField entity = new EntityWithFinalField( "foo" );