Skip to content

Commit c5b42de

Browse files
committed
HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.lazytoone
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 77af73b commit c5b42de

File tree

4 files changed

+24
-30
lines changed

4 files changed

+24
-30
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/lazytoone/LanyProxylessManyToOneTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import static org.hamcrest.CoreMatchers.nullValue;
3333
import static org.hamcrest.CoreMatchers.sameInstance;
3434
import static org.hamcrest.MatcherAssert.assertThat;
35-
import static org.junit.Assert.assertTrue;
35+
import static org.junit.jupiter.api.Assertions.assertTrue;
3636

3737
import org.junit.jupiter.api.AfterEach;
3838
import org.junit.jupiter.api.BeforeEach;

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/lazytoone/LazyToOneTest.java

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
package org.hibernate.orm.test.mapping.lazytoone;
66

77
import org.hibernate.Hibernate;
8-
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
9-
import org.hibernate.cfg.AvailableSettings;
108
import org.hibernate.proxy.HibernateProxy;
119
import org.hibernate.stat.spi.StatisticsImplementor;
1210

13-
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
14-
import org.junit.Test;
11+
import org.hibernate.testing.orm.junit.DomainModel;
12+
import org.hibernate.testing.orm.junit.SessionFactory;
13+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
14+
import org.junit.jupiter.api.Test;
15+
import org.junit.jupiter.api.AfterEach;
16+
import org.junit.jupiter.api.BeforeEach;
1517

1618
import static org.hamcrest.CoreMatchers.instanceOf;
1719
import static org.hamcrest.CoreMatchers.is;
@@ -20,22 +22,14 @@
2022
/**
2123
* @author Steve Ebersole
2224
*/
23-
public class LazyToOneTest extends BaseNonConfigCoreFunctionalTestCase {
24-
25-
@Override
26-
protected Class<?>[] getAnnotatedClasses() {
27-
return new Class[] { Airport.class, Flight.class };
28-
}
29-
30-
@Override
31-
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
32-
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
33-
}
34-
35-
@Override
36-
protected void prepareTest() throws Exception {
37-
inTransaction(
38-
(session) -> {
25+
@DomainModel(annotatedClasses = {Airport.class, Flight.class})
26+
@SessionFactory(generateStatistics = true)
27+
public class LazyToOneTest {
28+
29+
@BeforeEach
30+
protected void prepareTest(SessionFactoryScope scope) throws Exception {
31+
scope.inTransaction(
32+
session -> {
3933
final Airport austin = new Airport( 1, "AUS" );
4034
final Airport baltimore = new Airport( 2, "BWI" );
4135

@@ -51,18 +45,18 @@ protected void prepareTest() throws Exception {
5145
);
5246
}
5347

54-
@Override
55-
protected void cleanupTestData() throws Exception {
56-
sessionFactory().getSchemaManager().truncate();
48+
@AfterEach
49+
protected void cleanupTestData(SessionFactoryScope scope) throws Exception {
50+
scope.dropData();
5751
}
5852

5953
@Test
60-
public void testNonEnhanced() {
61-
final StatisticsImplementor statistics = sessionFactory().getStatistics();
54+
public void testNonEnhanced(SessionFactoryScope scope) {
55+
final StatisticsImplementor statistics = scope.getSessionFactory().getStatistics();
6256
statistics.clear();
6357

64-
inTransaction(
65-
(session) -> {
58+
scope.inTransaction(
59+
session -> {
6660
final Flight flight1 = session.byId( Flight.class ).load( 1 );
6761

6862
assertThat( statistics.getPrepareStatementCount(), is( 1L ) );

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/lazytoone/ManyToOneExplicitOptionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import static org.hamcrest.CoreMatchers.nullValue;
3838
import static org.hamcrest.CoreMatchers.sameInstance;
3939
import static org.hamcrest.MatcherAssert.assertThat;
40-
import static org.junit.Assert.assertTrue;
40+
import static org.junit.jupiter.api.Assertions.assertTrue;
4141

4242
/**
4343
* Baseline test for uni-directional to-one, using an explicit @LazyToOne(NO_PROXY)

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/lazytoone/mappedby/InverseToOneExplicitOptionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import static org.hamcrest.CoreMatchers.instanceOf;
3131
import static org.hamcrest.CoreMatchers.is;
3232
import static org.hamcrest.MatcherAssert.assertThat;
33-
import static org.junit.Assert.assertTrue;
33+
import static org.junit.jupiter.api.Assertions.assertTrue;
3434

3535
/**
3636
* Baseline test for inverse (mappedBy) to-one, using an explicit @LazyToOne(NO_PROXY)

0 commit comments

Comments
 (0)