Skip to content

Commit fb22587

Browse files
committed
HHH-19846 - Remove JUnit4: org.hibernate.orm.test.dialect.resolver
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 40fbdb2 commit fb22587

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/dialect/resolver/DialectFactoryTest.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,27 @@
1919
import org.hibernate.engine.jdbc.dialect.spi.DialectResolver;
2020
import org.hibernate.orm.test.dialect.TestingDialects;
2121
import org.hibernate.service.spi.ServiceRegistryImplementor;
22-
import org.hibernate.testing.junit4.BaseUnitTestCase;
2322
import org.hibernate.testing.util.ServiceRegistryUtil;
24-
import org.junit.After;
25-
import org.junit.Before;
26-
import org.junit.Test;
23+
import org.junit.jupiter.api.AfterEach;
24+
import org.junit.jupiter.api.BeforeEach;
25+
import org.junit.jupiter.api.Test;
2726

2827
import java.util.Collections;
2928
import java.util.HashMap;
3029
import java.util.Map;
3130

32-
import static org.junit.Assert.*;
31+
import static org.junit.jupiter.api.Assertions.assertEquals;
32+
import static org.junit.jupiter.api.Assertions.assertNull;
33+
import static org.junit.jupiter.api.Assertions.fail;
3334

3435
/**
3536
* @author Steve Ebersole
3637
*/
37-
public class DialectFactoryTest extends BaseUnitTestCase {
38+
public class DialectFactoryTest {
3839
private StandardServiceRegistry registry;
3940
private DialectFactoryImpl dialectFactory;
4041

41-
@Before
42+
@BeforeEach
4243
public void setUp() {
4344
final BootstrapServiceRegistry bootReg = new BootstrapServiceRegistryBuilder().applyClassLoader(
4445
DialectFactoryTest.class.getClassLoader()
@@ -49,7 +50,7 @@ public void setUp() {
4950
dialectFactory.injectServices( (ServiceRegistryImplementor) registry );
5051
}
5152

52-
@After
53+
@AfterEach
5354
public void destroy() {
5455
if ( registry != null ) {
5556
registry.close();
@@ -80,7 +81,7 @@ public void testExplicitlySuppliedDialectClassName() {
8081
fail();
8182
}
8283
catch ( HibernateException e ) {
83-
assertEquals( "unexpected exception type", StrategySelectionException.class, e.getClass() );
84+
assertEquals( StrategySelectionException.class, e.getClass(), "unexpected exception type" );
8485
}
8586

8687
configValues.put( Environment.DIALECT, "java.lang.Object" );
@@ -89,7 +90,7 @@ public void testExplicitlySuppliedDialectClassName() {
8990
fail();
9091
}
9192
catch ( HibernateException e ) {
92-
assertEquals( "unexpected exception type", ClassCastException.class, e.getCause().getClass() );
93+
assertEquals( ClassCastException.class, e.getCause().getClass(), "unexpected exception type" );
9394
}
9495
}
9596

@@ -163,8 +164,6 @@ public void testCustomDialects() {
163164
resolvers.addResolver( new TestingDialects.MyDialectResolver1() );
164165
resolvers.addResolver( new TestingDialects.MyDialectResolver2() );
165166
resolvers.addResolver( new TestingDialects.MyOverridingDialectResolver1() );
166-
//DialectFactory.registerDialectResolver( "org.hibernate.dialect.NoSuchDialectResolver" );
167-
//DialectFactory.registerDialectResolver( "java.lang.Object" );
168167

169168
testDetermination( "MyDatabase1", TestingDialects.MyDialect1.class, resolvers );
170169
testDetermination( "MyDatabase2", 1, TestingDialects.MyDialect21.class, resolvers );

hibernate-core/src/test/java/org/hibernate/orm/test/dialect/resolver/DialectResolverTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55
package org.hibernate.orm.test.dialect.resolver;
66

7-
import static org.junit.Assert.assertEquals;
8-
import static org.junit.Assert.assertNull;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.assertNull;
99

1010
import org.hibernate.dialect.Dialect;
1111
import org.hibernate.orm.test.dialect.TestingDialects;
@@ -14,15 +14,15 @@
1414
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
1515
import org.hibernate.engine.jdbc.dialect.spi.DialectResolver;
1616
import org.hibernate.testing.orm.junit.JiraKey;
17-
import org.hibernate.testing.junit4.BaseUnitTestCase;
18-
import org.junit.Test;
17+
18+
import org.junit.jupiter.api.Test;
1919

2020
/**
2121
* @author Steve Ebersole
2222
*/
23-
public class DialectResolverTest extends BaseUnitTestCase {
23+
public class DialectResolverTest {
2424
@Test
25-
public void testDialects() throws Exception {
25+
public void testDialects() {
2626
DialectResolverSet resolvers = new DialectResolverSet();
2727

2828
resolvers.addResolverAtFirst( new TestingDialects.MyDialectResolver1() );
@@ -39,7 +39,7 @@ public void testDialects() throws Exception {
3939
}
4040

4141
@Test
42-
public void testErrorAndOrder() throws Exception {
42+
public void testErrorAndOrder() {
4343
DialectResolverSet resolvers = new DialectResolverSet();
4444

4545
resolvers.addResolverAtFirst( new TestingDialects.MyDialectResolver1() );
@@ -52,7 +52,7 @@ public void testErrorAndOrder() throws Exception {
5252
}
5353

5454
@Test
55-
public void testBasicDialectResolver() throws Exception {
55+
public void testBasicDialectResolver() {
5656
DialectResolverSet resolvers = new DialectResolverSet();
5757
// Simulating MyDialectResolver1 by BasicDialectResolvers
5858
resolvers.addResolver( new BasicDialectResolver( "MyDatabase1", TestingDialects.MyDialect1.class ) );

hibernate-core/src/test/java/org/hibernate/orm/test/dialect/resolver/StandardDialectResolverTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@
1111
import org.hibernate.dialect.SQLServerDialect;
1212
import org.hibernate.engine.jdbc.dialect.internal.StandardDialectResolver;
1313

14-
import org.hibernate.testing.junit4.BaseUnitTestCase;
15-
import org.junit.Test;
14+
import org.junit.jupiter.api.Test;
1615

17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertNotNull;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
17+
import static org.junit.jupiter.api.Assertions.assertNotNull;
1918

2019
/**
2120
* Unit test of the {@link StandardDialectResolver} class.
2221
*
2322
* @author Bryan Turner
2423
*/
25-
public class StandardDialectResolverTest extends BaseUnitTestCase {
24+
public class StandardDialectResolverTest {
2625

2726
@Test
2827
public void testResolveDialectInternalForSQLServer2000() {
@@ -183,12 +182,12 @@ private static void runDialectTest(
183182
}
184183
String dbms = builder.toString();
185184

186-
assertNotNull( "Dialect for " + dbms + " should not be null", dialect );
185+
assertNotNull( dialect, "Dialect for " + dbms + " should not be null" );
187186
// Make sure to test that the actual dialect class is as expected
188187
// (not just an instance of the expected dialect.
189-
assertEquals( "Dialect for " + dbms + " should be " + expectedDialect.getSimpleName(),
190-
expectedDialect,
191-
dialect.getClass()
192-
);
188+
assertEquals( expectedDialect,
189+
dialect.getClass(),
190+
"Dialect for " + dbms + " should be " + expectedDialect.getSimpleName()
191+
);
193192
}
194193
}

0 commit comments

Comments
 (0)