Skip to content

Commit 2d49bb4

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

File tree

8 files changed

+35
-42
lines changed

8 files changed

+35
-42
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/Administration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import jakarta.persistence.Basic;
78
import jakarta.persistence.Entity;
89
import jakarta.persistence.Id;

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/BusTrip.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import java.util.Date;
78
import java.util.List;
89
import java.util.Map;

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/ElementCollectionConverterTest.java

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,31 @@
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
66

7-
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
8-
7+
import org.hibernate.testing.orm.junit.DomainModel;
98
import org.hibernate.testing.orm.junit.JiraKey;
10-
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
119
import org.hibernate.testing.orm.junit.JiraKeyGroup;
12-
import org.junit.Test;
13-
14-
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
15-
import static org.junit.Assert.assertEquals;
16-
17-
@JiraKeyGroup( value = {
18-
@JiraKey( value = "HHH-11924" ),
19-
@JiraKey( value = "HHH-14529" )
20-
} )
21-
public class ElementCollectionConverterTest extends BaseCoreFunctionalTestCase {
22-
23-
@Override
24-
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
25-
super.prepareBootstrapRegistryBuilder( builder );
26-
}
27-
28-
@Override
29-
protected Class[] getAnnotatedClasses() {
30-
return new Class[] {
31-
Company.class,
32-
};
33-
}
34-
35-
@Override
36-
protected String[] getOrmXmlFiles() {
37-
return new String[] { "org/hibernate/orm/test/annotations/reflection/element-collection-converter-orm.xml" };
38-
}
39-
10+
import org.hibernate.testing.orm.junit.SessionFactory;
11+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
12+
import org.junit.jupiter.api.Test;
13+
14+
import static org.assertj.core.api.Assertions.assertThat;
15+
16+
@JiraKeyGroup(value = {
17+
@JiraKey(value = "HHH-11924"),
18+
@JiraKey(value = "HHH-14529")
19+
})
20+
@DomainModel(
21+
annotatedClasses = {
22+
Company.class
23+
},
24+
xmlMappings = "org/hibernate/orm/test/annotations/reflection/element-collection-converter-orm.xml"
25+
)
26+
@SessionFactory
27+
public class ElementCollectionConverterTest {
4028

4129
@Test
42-
public void testConverterIsAppliedToElementCollection() {
43-
doInHibernate( this::sessionFactory, session -> {
30+
public void testConverterIsAppliedToElementCollection(SessionFactoryScope scope) {
31+
scope.inTransaction( session -> {
4432
Company company = new Company();
4533
company.setId( 1L );
4634

@@ -52,16 +40,16 @@ public void testConverterIsAppliedToElementCollection() {
5240
session.persist( company );
5341
} );
5442

55-
doInHibernate( this::sessionFactory, session -> {
56-
String organizationId = (String) session
57-
.createNativeQuery( "select organizations from Company_organizations" )
43+
scope.inTransaction( session -> {
44+
String organizationId = session
45+
.createNativeQuery( "select organizations from Company_organizations", String.class )
5846
.getSingleResult();
59-
assertEquals( "ORG-ACME", organizationId );
47+
assertThat( organizationId ).isEqualTo( "ORG-ACME" );
6048

6149
Company company = session.find( Company.class, 1L );
6250

63-
assertEquals( 1, company.getOrganizations().size() );
64-
assertEquals( "ACME" , company.getOrganizations().get( 0 ).getOrganizationId());
51+
assertThat( company.getOrganizations().size() ).isEqualTo( 1 );
52+
assertThat( company.getOrganizations().get( 0 ).getOrganizationId() ).isEqualTo( "ACME" );
6553
} );
6654
}
6755
}

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/Match.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import jakarta.persistence.Entity;
78
import jakarta.persistence.Inheritance;
89
import jakarta.persistence.InheritanceType;

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/SocialSecurityMoralAccount.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import jakarta.persistence.DiscriminatorValue;
78
import jakarta.persistence.Entity;
89
import jakarta.persistence.IdClass;

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/SocialSecurityNumber.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import java.io.Serializable;
78
import jakarta.persistence.Embeddable;
89

@@ -21,9 +22,7 @@ public boolean equals(Object o) {
2122
final SocialSecurityNumber that = (SocialSecurityNumber) o;
2223

2324
if ( !countryCode.equals( that.countryCode ) ) return false;
24-
if ( !number.equals( that.number ) ) return false;
25-
26-
return true;
25+
return number.equals( that.number );
2726
}
2827

2928
public int hashCode() {

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/SocialSecurityPhysicalAccount.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import jakarta.persistence.Entity;
78

89
/**

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/reflection/TennisMatch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.orm.test.annotations.reflection;
6+
67
import jakarta.persistence.AttributeOverride;
78
import jakarta.persistence.AttributeOverrides;
89
import jakarta.persistence.Column;

0 commit comments

Comments
 (0)