From 9269d29679f54c7f1afc76350bd047835907444e Mon Sep 17 00:00:00 2001 From: Sualeh Fatehi Date: Sun, 8 Sep 2024 19:01:35 -0400 Subject: [PATCH] Add test for number of loaded database drivers --- .../TableReferencesFunctionReturn.java | 2 +- .../integration/test/DatabaseDriverTest.java | 21 +++++++++++++++++++ .../jdbc/OfflineConnectionUtility.java | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 schemacrawler-dbtest/src/test/java/schemacrawler/integration/test/DatabaseDriverTest.java diff --git a/schemacrawler-chatgpt/src/main/java/schemacrawler/tools/command/chatgpt/functions/TableReferencesFunctionReturn.java b/schemacrawler-chatgpt/src/main/java/schemacrawler/tools/command/chatgpt/functions/TableReferencesFunctionReturn.java index 9e04c7bcef..17326c362a 100644 --- a/schemacrawler-chatgpt/src/main/java/schemacrawler/tools/command/chatgpt/functions/TableReferencesFunctionReturn.java +++ b/schemacrawler-chatgpt/src/main/java/schemacrawler/tools/command/chatgpt/functions/TableReferencesFunctionReturn.java @@ -63,7 +63,7 @@ public String get() { case CHILD: return renderTableRelationships(TableReferenceType.CHILD); case ALL: - // Fall-through + // Fall-through default: return renderTableRelationships(TableReferenceType.PARENT) + NEW_LINE diff --git a/schemacrawler-dbtest/src/test/java/schemacrawler/integration/test/DatabaseDriverTest.java b/schemacrawler-dbtest/src/test/java/schemacrawler/integration/test/DatabaseDriverTest.java new file mode 100644 index 0000000000..4a186b81a2 --- /dev/null +++ b/schemacrawler-dbtest/src/test/java/schemacrawler/integration/test/DatabaseDriverTest.java @@ -0,0 +1,21 @@ +package schemacrawler.integration.test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import java.sql.Driver; +import java.util.Collection; +import org.junit.jupiter.api.Test; +import us.fatehi.utility.database.DatabaseUtility; + +public class DatabaseDriverTest { + + @Test + public void availableJDBCDrivers() throws Exception { + final Collection availableJDBCDrivers = DatabaseUtility.getAvailableJdbcDrivers(); + final int numJDBCDrivers = availableJDBCDrivers.size(); + assertThat( + "Number of of avilable JDBC drivers is not correct - found " + numJDBCDrivers, + numJDBCDrivers == 20, + is(true)); + } +} diff --git a/schemacrawler-offline/src/main/java/schemacrawler/tools/offline/jdbc/OfflineConnectionUtility.java b/schemacrawler-offline/src/main/java/schemacrawler/tools/offline/jdbc/OfflineConnectionUtility.java index 3f99aeaad0..4c543ea7c3 100644 --- a/schemacrawler-offline/src/main/java/schemacrawler/tools/offline/jdbc/OfflineConnectionUtility.java +++ b/schemacrawler-offline/src/main/java/schemacrawler/tools/offline/jdbc/OfflineConnectionUtility.java @@ -84,7 +84,7 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg final OfflineConnection otherOfflineConnection = (OfflineConnection) args[0]; return otherOfflineConnection.hashCode() == offlineDatabasePath.hashCode(); } - // Fall through + // Fall through default: throw new SQLFeatureNotSupportedException( String.format(