Enhance Code Coverage#2875
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2875 +/- ##
============================================
+ Coverage 59.23% 60.36% +1.12%
- Complexity 4797 4878 +81
============================================
Files 151 151
Lines 34781 34781
Branches 5829 5829
============================================
+ Hits 20604 20995 +391
+ Misses 11380 10962 -418
- Partials 2797 2824 +27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Removed the test for supportsSharding method, which checked JDBC 4.3 version and UnsupportedOperationException.
|
/azp run |
There was a problem hiding this comment.
Pull request overview
This PR adds extensive unit tests to improve code coverage for SQLServerPreparedStatement, SQLServerDatabaseMetaData, and SQLServerCallableStatement, with a focus on Azure DW branches, batch/bulk-copy behavior, and a wide range of callable parameter getter/setter APIs.
Changes:
PreparedStatementTest: Adds tests for null SQL inprepareStatement, bulk-copy batch edge cases (empty batches, column count mismatches, unsupported Azure DW types), SQL parsing around dots/comments, and batch execution error handling, including OUT/INOUT parameter validation.DatabaseMetaDataTest: Adds Azure DW-focused tests forgetIndexInfo,getColumns,getFunctionColumns, and foreign key-related APIs, including column/type mapping validation and empty-result behavior.CallableStatementTest: Adds broad coverage for time/date getters and setters (with/withoutCalendar), deprecatedgetBigDecimaloverloads, stream/LOB setters,setObjectandregisterOutParameterSQLType overloads, uniqueidentifier handling, and unsupported URL/RowId getters/setters.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/PreparedStatementTest.java |
New tests exercise bulk-copy batch edge cases, Azure DW unsupported types, SQL parsing with schema/table dots and comments, and batch exception behavior; also adds an OUT-parameter-in-batch validation test, but unintentionally removes the assertFalse static import required by existing tests. |
src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java |
Adds Azure DW coverage for getIndexInfo, getColumns, function metadata, and foreign-key-related APIs, including reflection-based manipulation of internal mappings and checks for column/type alignment and empty-result handling. |
src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java |
Extends callable statement coverage across time/date APIs, numeric precision/scale handling, TVP/structured parameters, various stream and LOB setters, SQLType-based setObject/registerOutParameter overloads, uniqueidentifier support, and “not supported” URL/RowId paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactor test documentation for clarity and remove line references.
Refactor comments for clarity in exception handling tests.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Enhanced code coverage for below classes: