Skip to content

Commit b51ff77

Browse files
committed
HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.inheritance/*
Signed-off-by: Jan Schatteman <[email protected]>
1 parent f5271ad commit b51ff77

9 files changed

+31
-32
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/discriminator/JoinedInheritanceEagerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.hibernate.testing.orm.junit.JiraKey;
1818
import org.hibernate.testing.orm.junit.SessionFactory;
1919
import org.hibernate.testing.orm.junit.SessionFactoryScope;
20-
import org.junit.Assert;
20+
import org.junit.jupiter.api.Assertions;
2121
import org.junit.jupiter.api.AfterEach;
2222
import org.junit.jupiter.api.BeforeEach;
2323
import org.junit.jupiter.api.Test;
@@ -77,7 +77,7 @@ public void joinUnrelatedCollectionOnBaseType(SessionFactoryScope scope) {
7777
fail( "Expected a resolution exception for property 'attributes'!" );
7878
}
7979
catch (IllegalArgumentException ex) {
80-
Assert.assertTrue( ex.getCause().getMessage().contains( "Could not resolve attribute 'attributes' "));
80+
Assertions.assertTrue( ex.getCause().getMessage().contains( "Could not resolve attribute 'attributes' "));
8181
}
8282
finally {
8383
session.getTransaction().commit();

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/discriminator/MultiInheritanceDiscriminatorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void testAbstractSuperClassMappingHbm(SessionFactoryScope scope) {
6868

6969
scope.inTransaction(
7070
session -> {
71-
AccountOwner _owner = session.get( AccountOwner.class, ownerId );
71+
AccountOwner _owner = session.find( AccountOwner.class, ownerId );
7272
assertEquals( 2, _owner.getCreditAccounts().size() );
7373
assertEquals( "CreditAccount", _owner.getCreditAccounts().iterator().next().getClass().getSimpleName() );
7474

@@ -113,7 +113,7 @@ public void testAbstractSuperClassMappingAnn(SessionFactoryScope scope) {
113113

114114
scope.inTransaction(
115115
session -> {
116-
AccOwner _owner = session.get( AccOwner.class, ownerId );
116+
AccOwner _owner = session.find( AccOwner.class, ownerId );
117117
assertEquals( 2, _owner.getCreditAccs().size() );
118118
assertEquals( "CreditAcc", _owner.getCreditAccs().iterator().next().getClass().getSimpleName() );
119119

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/discriminator/joined/JoinedSubclassInheritanceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +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.After;
11+
import org.junit.jupiter.api.AfterEach;
1212
import org.junit.jupiter.api.Test;
1313

1414
import static org.hamcrest.CoreMatchers.is;
@@ -24,7 +24,7 @@
2424
@SessionFactory
2525
public class JoinedSubclassInheritanceTest {
2626

27-
@After
27+
@AfterEach
2828
public void tearDown(SessionFactoryScope scope) {
2929
scope.inTransaction(
3030
session ->

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/joined/JoinedInheritanceSameTableDifferentSchemaTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
1616
import org.hibernate.testing.orm.junit.Jira;
1717
import org.hibernate.testing.util.ServiceRegistryUtil;
18-
import org.junit.Test;
18+
import org.junit.jupiter.api.Test;
1919

2020
import static org.assertj.core.api.Assertions.assertThat;
2121

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/joined/JoinedInheritanceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import static org.hamcrest.CoreMatchers.is;
2727
import static org.hamcrest.CoreMatchers.notNullValue;
2828
import static org.hamcrest.MatcherAssert.assertThat;
29-
import static org.junit.Assert.assertTrue;
29+
import static org.junit.jupiter.api.Assertions.assertTrue;
3030

3131
/**
3232
* @author Andrea Boriero

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/joined/JoinedInheritanceWithConcreteRootTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import static org.hamcrest.CoreMatchers.is;
2727
import static org.hamcrest.CoreMatchers.notNullValue;
2828
import static org.hamcrest.MatcherAssert.assertThat;
29-
import static org.junit.Assert.assertTrue;
29+
import static org.junit.jupiter.api.Assertions.assertTrue;
3030

3131
/**
3232
* @author Andrea Boriero

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/joined/JoinedInheritanceWithExplicitDiscriminatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import static org.hamcrest.CoreMatchers.is;
2626
import static org.hamcrest.CoreMatchers.notNullValue;
2727
import static org.hamcrest.MatcherAssert.assertThat;
28-
import static org.junit.Assert.assertTrue;
28+
import static org.junit.jupiter.api.Assertions.assertTrue;
2929

3030
/**
3131
* @author Andrea Boriero

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/joined/JoinedSubclassTest.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55
package org.hibernate.orm.test.mapping.inheritance.joined;
66

7-
import java.util.Iterator;
87
import java.util.List;
98
import jakarta.persistence.criteria.CriteriaBuilder;
109
import jakarta.persistence.criteria.CriteriaQuery;
@@ -66,46 +65,46 @@ public void testJoinedSubclass(SessionFactoryScope scope) {
6665
s.persist( mark );
6766
s.persist( joe );
6867

69-
assertEquals( s.createQuery( "from Person" ).list().size(), 3 );
70-
assertEquals( s.createQuery( "from Person p where p.class = Customer" ).list().size(), 1 );
71-
assertEquals( s.createQuery( "from Person p where p.class = Person" ).list().size(), 1 );
72-
assertEquals( s.createQuery( "from Person p where type(p) in :who" )
68+
assertEquals( 3, s.createQuery( "from Person" ).list().size() );
69+
assertEquals( 1, s.createQuery( "from Person p where p.class = Customer" ).list().size() );
70+
assertEquals( 1, s.createQuery( "from Person p where p.class = Person" ).list().size() );
71+
assertEquals( 1, s.createQuery( "from Person p where type(p) in :who" )
7372
.setParameter( "who", Customer.class )
7473
.list()
75-
.size(), 1 );
76-
assertEquals( s.createQuery( "from Person p where type(p) in :who" ).setParameterList(
74+
.size() );
75+
assertEquals( 2, s.createQuery( "from Person p where type(p) in :who" ).setParameterList(
7776
"who",
7877
new Class[] {
7978
Customer.class,
8079
Person.class
8180
}
82-
).list().size(), 2 );
81+
).list().size() );
8382
s.clear();
8483

8584
List customers = s.createQuery( "from Customer c left join fetch c.salesperson" ).list();
86-
for ( Iterator iter = customers.iterator(); iter.hasNext(); ) {
87-
Customer c = (Customer) iter.next();
85+
for ( Object o : customers ) {
86+
Customer c = (Customer) o;
8887
assertTrue( Hibernate.isInitialized( c.getSalesperson() ) );
89-
assertEquals( c.getSalesperson().getName(), "Mark" );
88+
assertEquals( "Mark", c.getSalesperson().getName() );
9089
}
91-
assertEquals( customers.size(), 1 );
90+
assertEquals( 1, customers.size() );
9291
s.clear();
9392

9493
customers = s.createQuery( "from Customer" ).list();
95-
for ( Iterator iter = customers.iterator(); iter.hasNext(); ) {
96-
Customer c = (Customer) iter.next();
94+
for ( Object customer : customers ) {
95+
Customer c = (Customer) customer;
9796
assertFalse( Hibernate.isInitialized( c.getSalesperson() ) );
98-
assertEquals( c.getSalesperson().getName(), "Mark" );
97+
assertEquals( "Mark", c.getSalesperson().getName() );
9998
}
100-
assertEquals( customers.size(), 1 );
99+
assertEquals( 1, customers.size() );
101100
s.clear();
102101

103102

104-
mark = (Employee) s.get( Employee.class, new Long( mark.getId() ) );
105-
joe = (Customer) s.get( Customer.class, new Long( joe.getId() ) );
103+
mark = s.find( Employee.class, mark.getId() );
104+
joe = s.find( Customer.class, joe.getId() );
106105

107106
mark.setZip( "30306" );
108-
assertEquals( s.createQuery( "from Person p where p.address.zip = '30306'" ).list().size(), 1 );
107+
assertEquals( 1, s.createQuery( "from Person p where p.address.zip = '30306'" ).list().size() );
109108

110109
CriteriaBuilder criteriaBuilder = s.getCriteriaBuilder();
111110
CriteriaQuery<Person> criteria = criteriaBuilder.createQuery( Person.class );

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/inheritance/joined/MixedInheritanceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import static org.hamcrest.CoreMatchers.is;
2929
import static org.hamcrest.CoreMatchers.notNullValue;
3030
import static org.hamcrest.MatcherAssert.assertThat;
31-
import static org.junit.Assert.assertEquals;
32-
import static org.junit.Assert.assertTrue;
31+
import static org.junit.jupiter.api.Assertions.assertEquals;
32+
import static org.junit.jupiter.api.Assertions.assertTrue;
3333

3434
/**
3535
* @author Andrea Boriero
@@ -155,7 +155,7 @@ public void subclassQueryExecutionTest(SessionFactoryScope scope) {
155155
ForeignCustomer.class
156156
).list();
157157

158-
assertEquals( results.size(), 2 );
158+
assertEquals( 2, results.size() );
159159

160160
for ( ForeignCustomer foreignCustomer : results ) {
161161
if ( foreignCustomer.getId() == 2 ) {

0 commit comments

Comments
 (0)