From 5d51d48cea3b3b5e49b7f88b704e5a1589cb0854 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Thu, 26 Mar 2020 20:59:55 -0700 Subject: [PATCH] HHH-13910 : Added and corrected tests (cherry picked from commit caded6cd40877e082bcd93e8a20ce70a969efe90) --- .../internal/StandardDialectResolverTest.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/engine/jdbc/dialect/internal/StandardDialectResolverTest.java b/hibernate-core/src/test/java/org/hibernate/engine/jdbc/dialect/internal/StandardDialectResolverTest.java index ceb6416c5f..5858a52e18 100644 --- a/hibernate-core/src/test/java/org/hibernate/engine/jdbc/dialect/internal/StandardDialectResolverTest.java +++ b/hibernate-core/src/test/java/org/hibernate/engine/jdbc/dialect/internal/StandardDialectResolverTest.java @@ -13,8 +13,8 @@ import java.sql.SQLException; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; /** * Unit test of the {@link StandardDialectResolver} class. @@ -44,7 +44,7 @@ public void testResolveDialectInternalForSQLServer2008() @Test public void testResolveDialectInternalForSQLServer2012() throws SQLException { - runSQLServerDialectTest( 11, SQLServer2008Dialect.class ); + runSQLServerDialectTest( 11, SQLServer2012Dialect.class ); } @Test @@ -93,7 +93,7 @@ public void testResolveDialectInternalForPostgres91() throws SQLException { @Test public void testResolveDialectInternalForPostgres92() throws SQLException { - runPostgresDialectTest( 9, 2, PostgreSQL9Dialect.class ); + runPostgresDialectTest( 9, 2, PostgreSQL92Dialect.class ); } @Test @@ -131,6 +131,17 @@ public void testResolveDialectInternalForMySQL57() throws SQLException { runMySQLDialectTest( 5, 7, MySQL57Dialect.class ); } + @Test + public void testResolveDialectInternalForMySQL6() throws SQLException { + runMySQLDialectTest( 6, 0, MySQL57Dialect.class ); + } + + @Test + public void testResolveDialectInternalForMySQL7() throws SQLException { + runMySQLDialectTest( 7, 0, MySQL57Dialect.class ); + } + + @Test public void testResolveDialectInternalForMySQL8() throws SQLException { runMySQLDialectTest( 8, 0, MySQL8Dialect.class ); @@ -188,8 +199,11 @@ private static void runDialectTest( String dbms = builder.toString(); assertNotNull( "Dialect for " + dbms + " should not be null", dialect ); - assertTrue( "Dialect for " + dbms + " should be " - + expectedDialect.getSimpleName(), - expectedDialect.isInstance( dialect ) ); + // Make sure to test that the actual dialect class is as expected + // (not just an instance of the expected dialect. + assertEquals( "Dialect for " + dbms + " should be " + expectedDialect.getSimpleName(), + expectedDialect, + dialect.getClass() + ); } }