Skip to content

test: cover multi-role @Secured in kotlin rule tests#95

Merged
boorad merged 1 commit into
mainfrom
test/kotlin-secured-multi-role
May 29, 2026
Merged

test: cover multi-role @Secured in kotlin rule tests#95
boorad merged 1 commit into
mainfrom
test/kotlin-secured-multi-role

Conversation

@boorad
Copy link
Copy Markdown
Collaborator

@boorad boorad commented May 29, 2026

Summary

Adds a rule test for @Secured("ROLE_A", "ROLE_B") to the Kotlin Spring Secured rule, addressing a CodeRabbit nitpick from #93. The rule's header comment already describes multi-role handling (the matcher fires once per string argument, then dedup collapses to a single finding); this test locks that behavior in.

Changes

  • rules/kotlin/spring-secured.toml: new [[rule.tests]] block with a two-role @Secured annotation, expect_match = true, placed between the fully-qualified @Secured case and the negative @Override case.

Testing

  • cargo run -- rules test → 426 passed, 0 failed.

Summary by CodeRabbit

  • Tests
    • Extended test coverage for Spring Security role validation to ensure proper detection of multiple role assignments in @Secured annotations.

Review Change Stack

@boorad boorad self-assigned this May 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: be7675ad-f3e8-4294-a921-3d690fb5ce2c

📥 Commits

Reviewing files that changed from the base of the PR and between b853bc0 and 4adc8c4.

📒 Files selected for processing (1)
  • rules/kotlin/spring-secured.toml

📝 Walkthrough

Walkthrough

This PR extends the Kotlin Spring Security RBAC test suite by adding a new test case for the @Secured annotation with multiple string role arguments, verifying the matcher correctly identifies @Secured("ROLE_ADMIN", "ROLE_SUPERUSER") as a matching pattern.

Changes

Multi-role @Secured Test Coverage

Layer / File(s) Summary
Multi-role @Secured test case
rules/kotlin/spring-secured.toml
New test case added for @Secured with two role arguments ("ROLE_ADMIN", "ROLE_SUPERUSER") expecting expect_match = true to validate the rule correctly matches multi-role annotations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A fluffy test hops in with roles so bright,
Two ADMIN guards and SUPERUSER might,
Spring Security's armor now complete,
Multi-role bunnies make the rule more sweet! 🎯

🚥 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 accurately describes the main change: adding a test case for multi-role @Secured annotations in the Kotlin Spring Security rule.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/kotlin-secured-multi-role

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

Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

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

This PR cleanly adds test coverage for multi-role @Secured annotations in Kotlin Spring Security rules. The new test case is well-formed, follows existing patterns, and correctly validates the behavior described in the rule's header comments. The implementation has no blocking defects.

Test Results: 426 passed, 0 failed ✓

The changes are ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@boorad boorad merged commit 4822e87 into main May 29, 2026
3 checks passed
@boorad boorad deleted the test/kotlin-secured-multi-role branch May 29, 2026 02:33
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.

1 participant