Skip to content

Commit 287debf

Browse files
committed
HHH-19846 - Drop JUnit 4 usage
Not converted... * org.hibernate.orm.test.hql.PostgreSQLFunctionSelectClauseTest - registering custom function * org.hibernate.orm.test.hql.PostgreSQLFunctionWhereClauseTest - aux-db-object * org.hibernate.orm.test.id.usertype - type registrations * org.hibernate.orm.test.idgen.enhanced.HiloOptimizerConcurrencyTest - recreation of SF during tests * org.hibernate.orm.test.type.AbstractJavaTimeTypeTest subtypes - crazy parameterization (see org.hibernate.orm.test.tm.InterceptorTransactionTest) * org.hibernate.orm.test.cdi.general.hibernatesearch.extended.HibernateSearchExtendedCdiSupportTest - not sure yet, all the other tests here pass with conversion - shelved for now
1 parent f7ad8fd commit 287debf

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/entitymode/map/basic/DynamicClassTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.hibernate.testing.orm.junit.DomainModel;
99
import org.hibernate.testing.orm.junit.SessionFactory;
1010
import org.hibernate.testing.orm.junit.SessionFactoryScope;
11+
import org.junit.jupiter.api.AfterEach;
1112
import org.junit.jupiter.api.Test;
1213

1314
import java.util.ArrayList;
@@ -25,11 +26,16 @@
2526
/**
2627
* @author Gavin King
2728
*/
29+
@SuppressWarnings("JUnitMalformedDeclaration")
2830
@SessionFactory
2931
@DomainModel(
3032
xmlMappings = "org/hibernate/orm/test/entitymode/map/basic/ProductLine.hbm.xml"
3133
)
3234
class DynamicClassTest {
35+
@AfterEach
36+
void tearDown(SessionFactoryScope factoryScope) {
37+
factoryScope.dropData();
38+
}
3339

3440
@Test
3541
void testLazyDynamicClass(SessionFactoryScope scope) {

hibernate-core/src/test/java/org/hibernate/orm/test/entitymode/map/compositeId/CompositeIdTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@
1010
import org.hibernate.testing.orm.junit.DomainModel;
1111
import org.hibernate.testing.orm.junit.SessionFactory;
1212
import org.hibernate.testing.orm.junit.SessionFactoryScope;
13+
import org.junit.jupiter.api.AfterEach;
1314
import org.junit.jupiter.api.Test;
1415

1516
import static org.hamcrest.CoreMatchers.is;
1617
import static org.hamcrest.MatcherAssert.assertThat;
1718
import static org.junit.jupiter.api.Assertions.assertNotNull;
1819

20+
@SuppressWarnings("JUnitMalformedDeclaration")
1921
@DomainModel(
2022
xmlMappings = "org/hibernate/orm/test/entitymode/map/compositeId/CompId.hbm.xml"
2123
)
2224
@SessionFactory
2325
@JiraKey(value = "HHH-15201")
2426
public class CompositeIdTest {
27+
@AfterEach
28+
void tearDown(SessionFactoryScope factoryScope) {
29+
factoryScope.dropData();
30+
}
2531

2632
@Test
2733
public void testImplicitCompositeIdInDynamicMapMode(SessionFactoryScope scope) {

hibernate-core/src/test/java/org/hibernate/orm/test/entitymode/map/subclass/SubclassDynamicMapTest.java

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,30 @@
44
*/
55
package org.hibernate.orm.test.entitymode.map.subclass;
66

7-
import java.util.HashMap;
8-
9-
import org.junit.Test;
7+
import org.hibernate.testing.orm.junit.DomainModel;
8+
import org.hibernate.testing.orm.junit.SessionFactory;
9+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
10+
import org.junit.jupiter.api.AfterEach;
11+
import org.junit.jupiter.api.Test;
1012

11-
import org.hibernate.Session;
12-
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
13+
import java.util.HashMap;
1314

1415
/**
1516
* @author Steve Ebersole
1617
*/
17-
public class SubclassDynamicMapTest extends BaseCoreFunctionalTestCase {
18-
19-
@Override
20-
protected String getBaseForMappings() {
21-
return "org/hibernate/orm/test/";
22-
}
23-
24-
@Override
25-
public String[] getMappings() {
26-
return new String[] { "entitymode/map/subclass/Mappings.hbm.xml" };
18+
@SuppressWarnings("JUnitMalformedDeclaration")
19+
@DomainModel(xmlMappings = "org/hibernate/orm/test/entitymode/map/subclass/Mappings.hbm.xml")
20+
@SessionFactory
21+
public class SubclassDynamicMapTest {
22+
@AfterEach
23+
void tearDown(SessionFactoryScope factoryScope) {
24+
factoryScope.dropData();
2725
}
2826

2927
@Test
30-
public void testConcreateSubclassDeterminationOnEmptyDynamicMap() {
31-
Session s = openSession();
32-
s.beginTransaction();
33-
s.persist( "Superclass", new HashMap() );
34-
s.getTransaction().commit();
35-
s.close();
36-
37-
s = openSession();
38-
s.beginTransaction();
39-
s.createQuery( "delete Superclass" ).executeUpdate();
40-
s.getTransaction().commit();
41-
s.close();
28+
public void testConcreteSubclassDeterminationOnEmptyDynamicMap(SessionFactoryScope factoryScope) {
29+
factoryScope.inTransaction( (session) -> {
30+
session.persist( "Superclass", new HashMap() );
31+
} );
4232
}
4333
}

0 commit comments

Comments
 (0)