Skip to content

Refactored getAllUnits to Simplify Logic and Added Unit Tests#5997

Merged
HammerGS merged 1 commit into
MegaMek:masterfrom
IllianiBird:unitFilterFix
Feb 8, 2025
Merged

Refactored getAllUnits to Simplify Logic and Added Unit Tests#5997
HammerGS merged 1 commit into
MegaMek:masterfrom
IllianiBird:unitFilterFix

Conversation

@IllianiBird

@IllianiBird IllianiBird commented Feb 6, 2025

Copy link
Copy Markdown
Collaborator
  • Refactored the getAllUnits method by restructuring conditional logic and initializing allUnits at the declaration point, improving code clarity.
  • Added comprehensive unit tests to validate the method's behavior across various scenarios, to prevent regression.

Fix #5995

Refactored the `getAllUnits` method by restructuring conditional logic and initializing `allUnits` at the declaration point, improving code clarity. Added comprehensive unit tests to validate the method's behavior across various scenarios, ensuring correctness for both standard and non-standard force cases.
@IllianiBird IllianiBird added Bug Tests Issues or Pull Requests related to the project tests labels Feb 6, 2025
@IllianiBird IllianiBird self-assigned this Feb 6, 2025
@codecov-commenter

codecov-commenter commented Feb 6, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.34%. Comparing base (a428dfd) to head (759e5af).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5997      +/-   ##
============================================
+ Coverage     10.32%   10.34%   +0.02%     
- Complexity     6113     6130      +17     
============================================
  Files          1038     1038              
  Lines        139294   139294              
  Branches      20662    20663       +1     
============================================
+ Hits          14382    14412      +30     
+ Misses       123468   123439      -29     
+ Partials       1444     1443       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -0,0 +1,158 @@
package mekhq.campaign.force;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copyright?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Whoops!

@psikomonkie psikomonkie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! I think I'll copy your comment style for Arrange, Act, and Assert - I think it helps make it more approachable.

@HammerGS HammerGS merged commit 080bb95 into MegaMek:master Feb 8, 2025
@IllianiBird IllianiBird deleted the unitFilterFix branch March 23, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Tests Issues or Pull Requests related to the project tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] Forces cannot be deployed to stratcon tracks

5 participants