Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify comparison strategy isLessThan and isLessThanOrEqualTo in AbstractComparisonStrategy #3694

Merged

Conversation

cookieMr
Copy link
Contributor

@cookieMr cookieMr commented Dec 8, 2024

Check List:

Following the contributing guidelines will make it easier for us to review and accept your PR.

@@ -61,12 +61,12 @@ public boolean arrayContains(Object array, Object value) {

@Override
public boolean isLessThan(Object actual, Object other) {
return !areEqual(actual, other) && !isGreaterThan(actual, other);
return !isGreaterThanOrEqualTo(actual, other);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

@Override
public boolean isLessThanOrEqualTo(Object actual, Object other) {
return areEqual(actual, other) || isLessThan(actual, other);
return !isGreaterThan(actual, other);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need to call twice the areEqual (2nd call was negated)

@joel-costigliola joel-costigliola merged commit 94f1abd into assertj:3.x Dec 8, 2024
11 checks passed
@joel-costigliola
Copy link
Member

joel-costigliola commented Dec 8, 2024

Good catch, thanks @cookieMr.

@cookieMr cookieMr deleted the simplity_is_less_than_or_eq_to branch December 8, 2024 18:23
@scordio scordio added this to the 3.27.0 milestone Dec 8, 2024
@scordio scordio changed the title Simplity is less than or eq to Simplify isLessThan and isLessThanOrEqualTo Dec 14, 2024
@scordio scordio changed the title Simplify isLessThan and isLessThanOrEqualTo Simplify comparison strategy isLessThan and isLessThanOrEqualTo in AbstractComparisonStrategy Dec 14, 2024
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.

3 participants