Skip to content

Commit 007a349

Browse files
jrenaatsebersole
authored andcommitted
HHH-19846 - Drop JUnit 4 Usage
Signed-off-by: Jan Schatteman <jschatte@redhat.com> HHH-19846 - Remove JUnit4: org.hibernate.bytecode.internal.bytebuddy HHH-19846 - Remove JUnit4: org.hibernate.dialect HHH-19846 - Remove JUnit4: org.hibernate.engine.jdbc.env.internal HHH-19846 - Remove JUnit4: org.hibernate.orm.test.actionqueue HHH-19846 - Remove JUnit4: org.hibernate.orm.test.annotations HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.functional HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.resolver HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.unit.lockhint HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.function HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.unit.locktimeout HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.unit.sequence HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.access HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.basic/bitset HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dirtiness HHH-19846 - Remove JUnit4: org.hibernate.orm.test.distinct HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.collections HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.collections.custom.basic/declaredtype/parameterized HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.dynamic HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.lazytoone HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.converted.converter HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.converted.enums HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.converter.* HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.embeddable.* HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.fetch/formula/generated HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.identifier/* HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.inheritance/* HHH-19846 - Remove JUnit4: org.hibernate.orm.test.mapping.* HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.callbacks/cascade HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.compliance + tck2_2 HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.graphs/* HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.jointable HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.metamodel/ops HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.orphan/persistenceunit HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.procedure HHH-19846 - Remove JUnit4: org.hibernate.orm.test.jpa.proxy/ql/schemagen Signed-off-by: Jan Schatteman <jschatte@redhat.com>
1 parent f4507a4 commit 007a349

File tree

367 files changed

+6563
-8146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+6563
-8146
lines changed

hibernate-core/src/test/java/NoPackageTest.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
*/
55
import org.hibernate.query.Query;
66

7+
import org.hibernate.testing.orm.junit.DomainModel;
78
import org.hibernate.testing.orm.junit.JiraKey;
8-
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
9-
import org.junit.Test;
9+
import org.hibernate.testing.orm.junit.SessionFactory;
10+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
11+
import org.junit.jupiter.api.Test;
1012

1113
import static org.junit.Assert.assertEquals;
1214

@@ -15,18 +17,20 @@
1517
* We had problems with ByteBuddy in the past.
1618
*/
1719
@JiraKey(value = "HHH-13112")
18-
public class NoPackageTest extends BaseCoreFunctionalTestCase {
20+
@DomainModel(annotatedClasses = {AnnotationMappedNoPackageEntity.class})
21+
@SessionFactory
22+
public class NoPackageTest {
1923

2024
@Test
21-
public void testNoException() {
22-
inTransaction( session -> {
25+
public void testNoException(SessionFactoryScope scope) {
26+
scope.inTransaction( session -> {
2327
AnnotationMappedNoPackageEntity box = new AnnotationMappedNoPackageEntity();
2428
box.setId( 42 );
2529
box.setName( "This feels dirty" );
2630
session.persist( box );
2731
} );
2832

29-
inTransaction( session -> {
33+
scope.inTransaction( session -> {
3034
Query<AnnotationMappedNoPackageEntity> query = session.createQuery(
3135
"select e from " + AnnotationMappedNoPackageEntity.class.getSimpleName() + " e",
3236
AnnotationMappedNoPackageEntity.class
@@ -35,11 +39,4 @@ public void testNoException() {
3539
assertEquals( (Integer) 42, box.getId() );
3640
} );
3741
}
38-
39-
@Override
40-
public Class<?>[] getAnnotatedClasses() {
41-
return new Class[] {
42-
AnnotationMappedNoPackageEntity.class
43-
};
44-
}
4542
}

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/ByteBuddyBasicProxyFactoryTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
*/
55
package org.hibernate.bytecode.internal.bytebuddy;
66

7-
import static org.junit.Assert.assertEquals;
8-
import static org.junit.Assert.assertFalse;
9-
import static org.junit.Assert.assertNull;
10-
import static org.junit.Assert.assertTrue;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.assertFalse;
9+
import static org.junit.jupiter.api.Assertions.assertNull;
10+
import static org.junit.jupiter.api.Assertions.assertTrue;
1111
import static org.junit.jupiter.api.Assertions.assertNotEquals;
1212

1313
import org.hibernate.testing.orm.junit.JiraKey;
14-
import org.junit.Test;
14+
import org.junit.jupiter.api.Test;
1515

1616
public class ByteBuddyBasicProxyFactoryTest {
1717

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/EnhanceByteCodeNotInProvidedClassLoaderTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import org.hibernate.bytecode.enhance.spi.Enhancer;
1515

1616
import org.hibernate.testing.orm.junit.JiraKey;
17-
import org.junit.Assert;
18-
import org.junit.Test;
17+
import org.junit.jupiter.api.Assertions;
18+
import org.junit.jupiter.api.Test;
1919

2020
/**
2121
* Tests that bytecode can be enhanced when the original class cannot be loaded from
@@ -31,9 +31,9 @@ public void test() {
3131
// Now use a fake class name so it won't be found in the ClassLoader
3232
// provided by DefaultEnhancementContext
3333
byte[] enhanced = enhancer.enhance( SimpleEntity.class.getName() + "Fake", buffer );
34-
Assert.assertNotNull( "This is null when there have been swallowed exceptions during enhancement. Check Logs!", enhanced );
34+
Assertions.assertNotNull( enhanced, "This is null when there have been swallowed exceptions during enhancement. Check Logs!" );
3535
// Make sure enhanced bytecode is different from original bytecode.
36-
Assert.assertFalse( Arrays.equals( buffer, enhanced ) );
36+
Assertions.assertFalse( Arrays.equals( buffer, enhanced ) );
3737
}
3838

3939
private byte[] readResource(Class<?> clazz) {
@@ -52,7 +52,7 @@ private byte[] readResource(Class<?> clazz) {
5252
os.close();
5353
}
5454
catch (IOException ex) {
55-
Assert.fail( "Should not have an IOException here" );
55+
Assertions.fail( "Should not have an IOException here" );
5656
}
5757
return os.toByteArray();
5858
}

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/EnhancerWildFlyNamesTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
import org.hibernate.bytecode.enhance.spi.Enhancer;
1414

1515
import org.hibernate.testing.orm.junit.JiraKey;
16-
import org.junit.Assert;
17-
import org.junit.Test;
16+
import org.junit.jupiter.api.Assertions;
17+
import org.junit.jupiter.api.Test;
1818

1919
/**
2020
* WildFly will use class names in "internal JVM format" when invoking the enhancer,
@@ -34,10 +34,10 @@ public void test() {
3434
buffer = readResource( resourceName );
3535
}
3636
catch (IOException e) {
37-
Assert.fail( "Should not have an IOException here" );
37+
Assertions.fail( "Should not have an IOException here" );
3838
}
3939
byte[] enhanced = enhancer.enhance( internalName, buffer );
40-
Assert.assertNotNull( "This is null when there have been swallowed exceptions during enhancement. Check Logs!", enhanced );
40+
Assertions.assertNotNull( enhanced, "This is null when there have been swallowed exceptions during enhancement. Check Logs!" );
4141
}
4242

4343
private byte[] readResource(String resourceName) throws IOException {

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/GenerateProxiesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
*/
55
package org.hibernate.bytecode.internal.bytebuddy;
66

7-
import static org.junit.Assert.assertNotNull;
7+
import static org.junit.jupiter.api.Assertions.assertNotNull;
88

99
import java.lang.reflect.InvocationTargetException;
1010

1111
import org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper;
12-
import org.junit.Test;
12+
import org.junit.jupiter.api.Test;
1313

1414
public class GenerateProxiesTest {
1515

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/ReflectionOptimizerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
import org.hibernate.bytecode.spi.ReflectionOptimizer;
88
import org.hibernate.testing.orm.junit.JiraKey;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.assertj.core.api.Assertions.assertThat;
12-
import static org.junit.Assert.assertNotNull;
12+
import static org.junit.jupiter.api.Assertions.assertNotNull;
1313

1414
/**
1515
* @author Steve Ebersole

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/SimpleEnhancerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.hibernate.bytecode.enhance.spi.EnhancementException;
1010
import org.hibernate.bytecode.enhance.spi.Enhancer;
1111
import org.hibernate.bytecode.spi.ByteCodeHelper;
12-
import org.junit.Test;
12+
import org.junit.jupiter.api.Test;
1313

1414
import java.io.IOException;
1515

hibernate-core/src/test/java/org/hibernate/bytecode/internal/bytebuddy/SuperTypesEnhancementTest.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
import org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper;
1818

1919
import org.hibernate.testing.orm.junit.JiraKey;
20-
import org.junit.Assert;
21-
import org.junit.Test;
20+
import org.junit.jupiter.api.Assertions;
21+
import org.junit.jupiter.api.Test;
2222
import org.junit.jupiter.params.ParameterizedTest;
2323
import org.junit.jupiter.params.provider.Arguments;
2424
import org.junit.jupiter.params.provider.MethodSource;
2525

26+
import static org.junit.jupiter.api.Assertions.assertEquals;
27+
import static org.junit.jupiter.api.Assertions.assertNotNull;
28+
import static org.junit.jupiter.api.Assertions.assertTrue;
29+
2630
/**
2731
* Verifies that proxies being generated by ByteBuddyProxyHelper
2832
* do not break the contract with PrimeAmongSecondarySupertypes.
@@ -58,36 +62,36 @@ private static Stream<Arguments> interfaces() {
5862
public void testNamingConventions(Method m) {
5963
final Class<?> returnType = m.getReturnType();
6064
final String expectedMethodName = "as" + returnType.getSimpleName();
61-
Assert.assertEquals( expectedMethodName, m.getName() );
62-
Assert.assertNotNull( m.isDefault() );
65+
assertEquals( expectedMethodName, m.getName() );
66+
assertNotNull( m.isDefault() );
6367
}
6468

6569
@ParameterizedTest
6670
@MethodSource("superTypeMethods")
6771
public void testAllsubInterfacesExtendTheSingleparent(Method m) {
6872
final Class<?> returnType = m.getReturnType();
69-
Assert.assertTrue( PrimeAmongSecondarySupertypes.class.isAssignableFrom( returnType ) );
73+
assertTrue( PrimeAmongSecondarySupertypes.class.isAssignableFrom( returnType ) );
7074
}
7175

7276
@ParameterizedTest
7377
@MethodSource("superTypeMethods")
7478
public void testSubInterfaceOverrides(Method m) throws NoSuchMethodException {
7579
final Class<?> returnType = m.getReturnType();
7680
final Method subMethod = returnType.getMethod( m.getName(), m.getParameterTypes() );
77-
Assert.assertNotNull( subMethod );
78-
Assert.assertNotNull( subMethod.isDefault() );
81+
assertNotNull( subMethod );
82+
assertNotNull( subMethod.isDefault() );
7983
}
8084

8185
@Test
8286
public void testHibernateProxyGeneration() {
8387
ProxyFactory enhancer = createProxyFactory( SampleClass.class, HibernateProxy.class );
8488
final Object proxy = enhancer.getProxy( Integer.valueOf( 1 ), null );
85-
Assert.assertTrue( HibernateProxy.class.isAssignableFrom( proxy.getClass() ) );
86-
Assert.assertTrue( proxy instanceof HibernateProxy );
89+
assertTrue( HibernateProxy.class.isAssignableFrom( proxy.getClass() ) );
90+
assertTrue( proxy instanceof HibernateProxy );
8791
PrimeAmongSecondarySupertypes casted = (PrimeAmongSecondarySupertypes) proxy;
8892
final HibernateProxy extracted = casted.asHibernateProxy();
89-
Assert.assertNotNull( extracted );
90-
Assert.assertSame( proxy, extracted );
93+
assertNotNull( extracted );
94+
Assertions.assertSame( proxy, extracted );
9195
testForLIE( (SampleClass) proxy );
9296
}
9397

@@ -96,8 +100,8 @@ public void testHibernateProxyGeneration() {
96100
*/
97101
private void testForLIE(SampleClass sampleProxy) {
98102
SampleClass other = new SampleClass();
99-
Assert.assertEquals( 7, other.additionMethod( 3,4 ) );
100-
Assert.assertThrows( LazyInitializationException.class, () -> sampleProxy.additionMethod( 3, 4 ) );
103+
assertEquals( 7, other.additionMethod( 3,4 ) );
104+
Assertions.assertThrows( LazyInitializationException.class, () -> sampleProxy.additionMethod( 3, 4 ) );
101105
}
102106

103107
private ProxyFactory createProxyFactory(Class<?> persistentClass, Class<?>... interfaces) {

hibernate-core/src/test/java/org/hibernate/dialect/H2DialectDatabaseVersionTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
*/
55
package org.hibernate.dialect;
66

7-
import static org.junit.Assert.assertEquals;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
88

99
import java.util.Map;
1010

1111
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
1212

13-
import org.hibernate.testing.RequiresDialect;
13+
import org.hibernate.testing.orm.junit.RequiresDialect;
1414
import org.hibernate.testing.orm.junit.JiraKey;
15-
import org.hibernate.testing.junit4.BaseUnitTestCase;
16-
import org.junit.Test;
15+
import org.junit.jupiter.api.Test;
1716

1817
@RequiresDialect(H2Dialect.class)
1918
@JiraKey(value = "HHH-17791")
20-
public class H2DialectDatabaseVersionTest extends BaseUnitTestCase {
19+
public class H2DialectDatabaseVersionTest {
2120

2221
@Test
2322
public void snapshotVersion() {

hibernate-core/src/test/java/org/hibernate/dialect/MySQLDialectDatabaseVersionTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66

77
import java.util.Map;
88
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
9-
import org.hibernate.testing.RequiresDialect;
9+
import org.hibernate.testing.orm.junit.RequiresDialect;
1010
import org.hibernate.testing.orm.junit.JiraKey;
11-
import org.hibernate.testing.junit4.BaseUnitTestCase;
12-
import org.junit.Test;
11+
import org.junit.jupiter.api.Test;
1312

1413

15-
import static org.junit.Assert.assertEquals;
14+
import static org.junit.jupiter.api.Assertions.assertEquals;
1615

1716
@RequiresDialect(MySQLDialect.class)
1817
@JiraKey(value = "HHH-18518")
19-
public class MySQLDialectDatabaseVersionTest extends BaseUnitTestCase {
18+
public class MySQLDialectDatabaseVersionTest {
2019

2120
@Test
2221
public void versionWithSuffix() {

0 commit comments

Comments
 (0)