HHH-18806 Use JUnit Jupiter API to make feature check effective
This commit is contained in:
parent
46b3b3a2d2
commit
6f887a516a
|
@ -8,31 +8,25 @@ import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
import org.hibernate.annotations.Nationalized;
|
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.DialectFeatureChecks;
|
||||||
|
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||||
|
import org.hibernate.testing.orm.junit.Jpa;
|
||||||
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
|
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;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
|
@Jpa(annotatedClasses = NationalizedTest.Product.class)
|
||||||
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsUnicodeNClob.class)
|
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsUnicodeNClob.class)
|
||||||
public class NationalizedTest extends BaseEntityManagerFunctionalTestCase {
|
public class NationalizedTest {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<?>[] getAnnotatedClasses() {
|
|
||||||
return new Class<?>[] {
|
|
||||||
Product.class
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test(EntityManagerFactoryScope scope) {
|
||||||
Integer productId = doInJPA(this::entityManagerFactory, entityManager -> {
|
Integer productId = scope.fromTransaction( entityManager -> {
|
||||||
//tag::basic-nationalized-persist-example[]
|
//tag::basic-nationalized-persist-example[]
|
||||||
final Product product = new Product();
|
final Product product = new Product();
|
||||||
product.setId(1);
|
product.setId(1);
|
||||||
|
@ -44,7 +38,7 @@ public class NationalizedTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
|
|
||||||
return product.getId();
|
return product.getId();
|
||||||
});
|
});
|
||||||
doInJPA(this::entityManagerFactory, entityManager -> {
|
scope.inTransaction( entityManager -> {
|
||||||
Product product = entityManager.find(Product.class, productId);
|
Product product = entityManager.find(Product.class, productId);
|
||||||
|
|
||||||
assertEquals("My product®™ warranty 😍", product.getWarranty());
|
assertEquals("My product®™ warranty 😍", product.getWarranty());
|
||||||
|
|
Loading…
Reference in New Issue