Skip to content

[Tests] Improve branch coverage for OperatorNode, FunctionNode, PaginatedGui, TableVersionHistoryDAO - #87

Open
DiamondDagger590 wants to merge 1 commit into
developfrom
claude/eager-thompson-h63cim
Open

[Tests] Improve branch coverage for OperatorNode, FunctionNode, PaginatedGui, TableVersionHistoryDAO#87
DiamondDagger590 wants to merge 1 commit into
developfrom
claude/eager-thompson-h63cim

Conversation

@DiamondDagger590

@DiamondDagger590 DiamondDagger590 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • OperatorNode: Added tests for the default switch paths in getValue() and needBrackets() using an unsupported operator character ('!'). Branch coverage: 95.7% → 100%
  • FunctionNode: Added test for the default switch path in getValue() using an out-of-range function index (FUNCTIONS.length). Branch coverage: 97.6% → 100%
  • PaginatedGui: Added test for setPage() when getMaximumPage() < 1 to cover the first Preconditions.checkArgument branch. Branch coverage: 90% → 100%
  • TableVersionHistoryDAO: Added test for updateTable() when the stored version is negative, covering the false branch of the latestStoredVersion == 0 check. Branch coverage: 87.5% → 100%

All four classes now have 100% branch coverage. Overall project branch coverage improved from 70.7% to 71.0%.

Test plan

  • All existing tests continue to pass (./gradlew test)
  • JaCoCo report confirms 100% branch coverage on all four target classes
  • Testing audit persona reviewed changes — no concerns found
  • No production code changes — test-only diff

Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Added regression coverage for preventing invalid table version updates.
    • Added validation coverage for pagination when no pages are available.
    • Added parser tests for invalid function indexes and unsupported operators.
    • Confirmed safe fallback values and correct formatting for unsupported expressions.

… TableVersionHistoryDAO

Add targeted tests to reach 100% branch coverage on four classes not
covered by existing open PRs:

- OperatorNode: cover default switch paths in getValue() and
  needBrackets() using an unsupported operator character
- FunctionNode: cover default switch path in getValue() using an
  out-of-range function index
- PaginatedGui: cover the Preconditions branch in setPage() when
  getMaximumPage() < 1
- TableVersionHistoryDAO: cover the false branch of the version-0 check
  in updateTable() using a negative stored version

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018GHx1mkRzHLV6Gox72jXvX
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The test suite adds regression coverage for invalid table versions, invalid pagination bounds, out-of-range function indexes, and unsupported operators.

Changes

Edge-case regression tests

Layer / File(s) Summary
Table version update validation
src/test/java/com/diamonddagger590/mccore/database/table/impl/TableVersionHistoryDAOTest.java
Adds a test that verifies a stored version of -1 is queried without executing an update.
Pagination bound validation
src/test/java/com/diamonddagger590/mccore/gui/PaginatedGuiTest.java
Adds a test that verifies page 1 is rejected when the maximum page is below one.
Parser fallback behavior
src/test/java/com/diamonddagger590/mccore/parser/FunctionNodeTest.java, src/test/java/com/diamonddagger590/mccore/parser/OperatorNodeTest.java
Adds tests for out-of-range function evaluation and unsupported operator evaluation and formatting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the branch-coverage tests added for the four named classes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/eager-thompson-h63cim

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Claude finished @DiamondDagger590's task in 1m 46s —— View job


Claude PR Review — in progress

  • Gather context (PR diff, changed files)
  • Route to review lenses (test-only diff touching gui/ and database/ test dirs → review-testing, review-extensibility)
  • Fan out to persona subagents (running)
  • Consolidate findings
  • Post final review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
src/test/java/com/diamonddagger590/mccore/database/table/impl/TableVersionHistoryDAOTest.java-226-229 (1)

226-229: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Verify that the history query executes.

The test stubs executeQuery() but does not verify that it was called. Add this assertion so the test proves that -1 was read from the history table before updateTable skips the update.

Suggested assertion
             verify(mockStatement).setString(1, "table_history");
+            verify(mockStatement).executeQuery();
             verify(mockStatement, never()).executeUpdate();

Also applies to: 231-234

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/com/diamonddagger590/mccore/database/table/impl/TableVersionHistoryDAOTest.java`
around lines 226 - 229, Update the test around the mocked history query in
TableVersionHistoryDAOTest to verify that mockStatement.executeQuery() is
invoked before updateTable skips the update. Keep the existing result-set
stubbing and -1 table_version assertion setup unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Other comments:
In
`@src/test/java/com/diamonddagger590/mccore/database/table/impl/TableVersionHistoryDAOTest.java`:
- Around line 226-229: Update the test around the mocked history query in
TableVersionHistoryDAOTest to verify that mockStatement.executeQuery() is
invoked before updateTable skips the update. Keep the existing result-set
stubbing and -1 table_version assertion setup unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: 37fe57a6-0bbc-40b7-9715-56fc9fadc7f5

📥 Commits

Reviewing files that changed from the base of the PR and between 0fbf220 and 53388f9.

📒 Files selected for processing (4)
  • src/test/java/com/diamonddagger590/mccore/database/table/impl/TableVersionHistoryDAOTest.java
  • src/test/java/com/diamonddagger590/mccore/gui/PaginatedGuiTest.java
  • src/test/java/com/diamonddagger590/mccore/parser/FunctionNodeTest.java
  • src/test/java/com/diamonddagger590/mccore/parser/OperatorNodeTest.java

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