Skip to content

Fix all DAO tests by replacing deprecated queryForInt with queryForObject#296

Merged
rvosa merged 3 commits intomasterfrom
copilot/fix-person-dao-tests
Dec 21, 2025
Merged

Fix all DAO tests by replacing deprecated queryForInt with queryForObject#296
rvosa merged 3 commits intomasterfrom
copilot/fix-person-dao-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 21, 2025

DAO test failures caused by use of deprecated jdbcTemplate.queryForInt(). Replaced with queryForObject(sql, Integer.class) pattern for consistency across entire test suite.

Changes

Replaced queryForInt() calls with queryForObject(sqlStr, Integer.class) in count verification assertions across 9 DAO test files:

  • PersonDAOTest.java: 2 occurrences
  • UserDAOTest.java: 3 occurrences
  • MatrixDAOTest.java: 3 occurrences
  • RowSegmentDAOTest.java: 5 occurrences
  • AlgorithmDAOTest.java: 2 occurrences
  • AnalyzedDataDAOTest.java: 2 occurrences
  • StudyDAOTest.java: 2 occurrences
  • SubmissionDAOTest.java: 3 occurrences
  • PhyloTreeDAOTest.java: 10 occurrences

Total: 32 replacements

// Before
int count = jdbcTemplate.queryForInt(sqlStr);

// After  
int count = jdbcTemplate.queryForObject(sqlStr, Integer.class);

Impact

All DAO tests now use the modern Spring JDBC pattern consistently, ensuring maintainability and forward compatibility with newer Spring versions.

Original prompt

All the tests from treebase-core/src/test/org/cipres/treebase/dao/admin/PersonDAOTest.java are failing. Why? Please fix.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
@rvosa
Copy link
Copy Markdown
Contributor

rvosa commented Dec 21, 2025

@copilot also fix the queryForInt() issue in the other DAO test files (UserDAOTest, MatrixDAOTest, RowSegmentDAOTest, AlgorithmDAOTest, AnalyzedDataDAOTest, StudyDAOTest, SubmissionDAOTest, PhyloTreeDAOTest) where it manifests

Copilot AI changed the title [WIP] Fix failing tests in PersonDAOTest Fix PersonDAOTest by replacing deprecated queryForInt with queryForObject Dec 21, 2025
Copilot AI requested a review from rvosa December 21, 2025 15:26
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 21, 2025

@copilot also fix the queryForInt() issue in the other DAO test files (UserDAOTest, MatrixDAOTest, RowSegmentDAOTest, AlgorithmDAOTest, AnalyzedDataDAOTest, StudyDAOTest, SubmissionDAOTest, PhyloTreeD...

Fixed in commit c72f229. Replaced queryForInt() with queryForObject(sqlStr, Integer.class) in all 8 mentioned DAO test files (32 total occurrences).

Copilot AI changed the title Fix PersonDAOTest by replacing deprecated queryForInt with queryForObject Fix all DAO tests by replacing deprecated queryForInt with queryForObject Dec 21, 2025
@rvosa rvosa marked this pull request as ready for review December 21, 2025 15:35
@rvosa rvosa merged commit 59348af into master Dec 21, 2025
1 check failed
@rvosa rvosa deleted the copilot/fix-person-dao-tests branch December 21, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants