Skip to content

Commit e53674b

Browse files
committed
HHH-19846 Drop JUnit 4 usage
1 parent 2d49bb4 commit e53674b

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/secondarytable/SecondaryTableSchemaTest.java

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,65 @@
44
*/
55
package org.hibernate.orm.test.annotations.secondarytable;
66

7-
import java.io.Serializable;
8-
import java.util.List;
9-
import java.util.Map;
107
import jakarta.persistence.Column;
118
import jakarta.persistence.Entity;
129
import jakarta.persistence.Id;
1310
import jakarta.persistence.PrimaryKeyJoinColumn;
1411
import jakarta.persistence.SecondaryTable;
1512
import jakarta.persistence.Table;
16-
1713
import org.hibernate.annotations.DynamicUpdate;
1814
import org.hibernate.annotations.OptimisticLockType;
1915
import org.hibernate.annotations.OptimisticLocking;
2016
import org.hibernate.annotations.SecondaryRow;
2117
import org.hibernate.cfg.AvailableSettings;
2218
import org.hibernate.dialect.H2Dialect;
23-
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
19+
import org.hibernate.testing.orm.junit.EntityManagerFactoryBasedFunctionalTest;
20+
import org.hibernate.testing.orm.junit.RequiresDialect;
21+
import org.junit.jupiter.api.Test;
2422

25-
import org.hibernate.testing.RequiresDialect;
26-
import org.junit.Test;
23+
import java.util.List;
24+
import java.util.Map;
25+
26+
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
2727

28-
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
29-
import static org.junit.Assert.assertTrue;
3028

3129
/**
3230
* @author Vlad Mihalcea
3331
*/
3432
@RequiresDialect(value = H2Dialect.class)
35-
public class SecondaryTableSchemaTest
36-
extends BaseEntityManagerFunctionalTestCase {
33+
public class SecondaryTableSchemaTest extends EntityManagerFactoryBasedFunctionalTest {
34+
3735

3836
@Override
3937
protected Class<?>[] getAnnotatedClasses() {
40-
return new Class<?>[] {
41-
Cluster.class,
42-
};
38+
return new Class[] {Cluster.class};
4339
}
4440

4541
protected void addConfigOptions(Map options) {
4642
options.put(
47-
AvailableSettings.URL,
48-
options.get( AvailableSettings.URL ) + ";INIT=CREATE SCHEMA IF NOT EXISTS schema1\\;CREATE SCHEMA IF NOT EXISTS schema2;"
43+
AvailableSettings.URL,
44+
options.get( AvailableSettings.URL )
45+
+ ";INIT=CREATE SCHEMA IF NOT EXISTS schema1\\;CREATE SCHEMA IF NOT EXISTS schema2;"
4946
);
5047
}
5148

5249
@Test
5350
public void test() {
54-
doInJPA( this::entityManagerFactory, entityManager -> {
55-
List<Cluster> clusters = entityManager.createQuery( "select c from Cluster c" ).getResultList();
51+
inTransaction( entityManager -> {
52+
List<Cluster> clusters = entityManager.createQuery( "select c from Cluster c", Cluster.class )
53+
.getResultList();
5654

57-
assertTrue(clusters.isEmpty());
55+
assertThat( clusters.isEmpty() ).isTrue();
5856
} );
5957
}
6058

6159
@Entity(name = "Cluster")
6260
@Table(name = "cluster", schema = "schema1")
63-
@SecondaryTable(name = "Cluster", schema="schema2", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "clusterid") })
61+
@SecondaryTable(name = "Cluster", schema = "schema2", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "clusterid")})
6462
@SecondaryRow(table = "Cluster", optional = false)
6563
@OptimisticLocking(type = OptimisticLockType.DIRTY)
6664
@DynamicUpdate
67-
public static class Cluster implements Serializable {
68-
private static final long serialVersionUID = 3965099001305947412L;
65+
public static class Cluster {
6966

7067
@Id
7168
@Column(name = "objid")

0 commit comments

Comments
 (0)