diff --git a/sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/common/DatabaseEnvironment.java b/sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/common/DatabaseEnvironment.java index 9992e93086517..8ea2e8fdc8b28 100644 --- a/sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/common/DatabaseEnvironment.java +++ b/sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/common/DatabaseEnvironment.java @@ -103,11 +103,7 @@ public String getDriverClassName() { * @return database URL */ public String getURL(final String dbName) { - String nowDbName = dbName; - if (null == nowDbName) { - nowDbName = DATABASE_NAME.get(databaseType); - } - return String.format(URL.get(databaseType), nowDbName); + return String.format(URL.get(databaseType), null == dbName ? DATABASE_NAME.get(databaseType) : dbName); } /**