From 6f887a516ad7a8b75be032f18e023f585f6a0128 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Tue, 17 Dec 2024 17:51:07 +0100 Subject: [PATCH] HHH-18806 Use JUnit Jupiter API to make feature check effective --- .../test/mapping/basic/NationalizedTest.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/basic/NationalizedTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/basic/NationalizedTest.java index 4dd0a0119f..d4c25f3322 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/basic/NationalizedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/basic/NationalizedTest.java @@ -8,31 +8,25 @@ import jakarta.persistence.Entity; import jakarta.persistence.Id; import org.hibernate.annotations.Nationalized; -import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; import org.hibernate.testing.orm.junit.DialectFeatureChecks; +import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; +import org.hibernate.testing.orm.junit.Jpa; import org.hibernate.testing.orm.junit.RequiresDialectFeature; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.junit.Assert.assertEquals; /** * @author Vlad Mihalcea */ +@Jpa(annotatedClasses = NationalizedTest.Product.class) @RequiresDialectFeature(feature = DialectFeatureChecks.SupportsUnicodeNClob.class) -public class NationalizedTest extends BaseEntityManagerFunctionalTestCase { - - @Override - protected Class[] getAnnotatedClasses() { - return new Class[] { - Product.class - }; - } +public class NationalizedTest { @Test - public void test() { - Integer productId = doInJPA(this::entityManagerFactory, entityManager -> { + public void test(EntityManagerFactoryScope scope) { + Integer productId = scope.fromTransaction( entityManager -> { //tag::basic-nationalized-persist-example[] final Product product = new Product(); product.setId(1); @@ -44,7 +38,7 @@ public class NationalizedTest extends BaseEntityManagerFunctionalTestCase { return product.getId(); }); - doInJPA(this::entityManagerFactory, entityManager -> { + scope.inTransaction( entityManager -> { Product product = entityManager.find(Product.class, productId); assertEquals("My product®™ warranty 😍", product.getWarranty());