Refactor FormServiceTest by splitting shouldFormCreateUpdateDelete into isolated tests#6228
Refactor FormServiceTest by splitting shouldFormCreateUpdateDelete into isolated tests#6228Saimandsroy wants to merge 1 commit into
Conversation
|
jwnasambu
left a comment
There was a problem hiding this comment.
Hi @Saimandsroy ! Thanks for the contribution. Per our PR Tips, please update the PR description to include a link to the related Jira issue. This helps us track and review your work more effectively. Thanks!
|
@claude review |
1 similar comment
|
@claude review |
|
@claude review |
| */ | ||
| @Test | ||
| public void shouldFormCreateUpdateDelete() { | ||
| public void shouldCreateForm() { |
There was a problem hiding this comment.
Before this lands, worth knowing that three of these four new tests recreate coverage that already exists as dedicated tests further down this same file, so they land as duplicates rather than new coverage:
shouldCreateFormoverlapssaveForm_shouldSaveGivenFormSuccessfully(line 1017)shouldUpdateFormoverlapssaveForm_shouldUpdateAnExistingForm(line 1035)shouldDeleteFormis essentially identical topurgeForm_shouldDeleteGivenFormSuccessfully(line 1098): the samegetForm(1),purgeForm(form),assertNull(getForm(1))sequence.
Only shouldRetireAndUnretireForm adds something not already covered by a standalone test, since retire/unretire was previously exercised only inside the monolithic test.
I'd suggest keeping shouldRetireAndUnretireForm and the removal of shouldFormCreateUpdateDelete, and dropping the other three, since the existing saveForm_* and purgeForm_* tests already cover create/update/delete (and follow the project's methodName_shouldExpectedBehavior naming). That still resolves the FIXME without adding redundant tests. This is a suggestion, not a blocker.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6228 +/- ##
============================================
+ Coverage 59.37% 59.41% +0.03%
- Complexity 9353 9361 +8
============================================
Files 695 695
Lines 37471 37471
Branches 5521 5521
============================================
+ Hits 22250 22264 +14
+ Misses 13225 13199 -26
- Partials 1996 2008 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



Summary
This pull request refactors the existing
shouldFormCreateUpdateDeletetest inFormServiceTestinto four focused and independent test methods, addressing an inline FIXME comment.Changes
shouldCreateFormshouldUpdateFormshouldRetireAndUnretireFormshouldDeleteFormVerification
FormServiceTesttest suite successfully.