Skip to content

Phase 3d: Add comprehensive SubscriptionController test coverage#32

Open
devin-ai-integration[bot] wants to merge 1 commit intotrunkfrom
devin/1775135720-subscription-controller-phase3d-continuation
Open

Phase 3d: Add comprehensive SubscriptionController test coverage#32
devin-ai-integration[bot] wants to merge 1 commit intotrunkfrom
devin/1775135720-subscription-controller-phase3d-continuation

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot commented Apr 2, 2026

Summary

Adds 15 new tests to SubscriptionControllerTest (19 → 34 total, 103 tests overall) to close behavioral coverage gaps identified by comparing the migrated Spring controller against the original Struts EditSubscriptionAction / SaveSubscriptionAction.

No production code changes — test-only PR.

New test categories:

  • Default action behavior — verifies omitting the action param defaults to "Create"
  • Form field population — asserts all 6 fields (action, host, username, password, type, autoConnect) are correctly copied from SubscriptionSubscriptionForm on Edit and Delete
  • Delete with non-existing subscription — confirms redirect (previously only tested for Edit)
  • Session attribute lifecycle — verifies SUBSCRIPTION_KEY is stored on edit and removed after save, cancel, and delete across all action types (5 tests)
  • AutoConnect handling — explicit true, implicit default false, and update-on-edit paths
  • Multiple simultaneous validation errors — all 4 required fields blank at once
  • User model attribute on error paths — ensures user is in the model when returning the form with validation errors or duplicate-host errors (needed for template rendering)

Review & Testing Checklist for Human

  • Verify session cleanup tests match intended controller behavior — do we actually want SUBSCRIPTION_KEY removed from the session on every save/cancel/delete path? Cross-reference with original SaveSubscriptionAction behavior.
  • Confirm the autoConnect default-to-false test (saveSubscription_CreateAction_WithoutAutoConnect_ShouldDefaultToFalse) reflects correct Struts-era semantics — original used PropertyUtils.copyProperties which may have behaved differently for unchecked checkboxes.
  • Spot-check that the new form-population tests (ShouldPopulateAllFormFields, ShouldPopulateFormFieldsFromSubscription) aren't redundant with the existing ShouldPopulateForm / ShouldShowForm tests — the new ones add field-level assertions the originals lacked.

Suggested test plan: cd apps/faces-example2 && mvn test — all 103 tests should pass.

Notes

  • Builds on merged PR Phase 3: SubscriptionController + SubscriptionForm migration #21 which added @NotBlank password validation and baseline controller tests.
  • Uses AssertJ (assertThat) for the new field-level and session assertions, consistent with Spring Boot test conventions. The existing tests used only MockMvc matchers.

Link to Devin session: https://jack-meigel.devinenterprise.com/sessions/8d11037d5a16405f975921abf07218fc
Requested by: @cogjack


Open with Devin

Add 15 new tests (19→34 total) covering behavioral gaps:
- Default action behavior (no action param defaults to Create)
- Form field population verification on Edit and Delete actions
- Delete action with non-existing subscription redirects correctly
- Session attribute management (subscription stored on edit, removed on save/cancel/delete)
- AutoConnect handling (set true, default false, update on edit)
- Multiple simultaneous validation errors
- User model attribute present on validation error and duplicate host paths

Co-Authored-By: Jack  Meigel <jack.meigel@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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