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

Introduce optional.orElseThrow() assertion #1547

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JulianBroudy
Copy link

Refaster:

assertThat(optional.orElseThrow()).isEqualTo(value);

to:

assertThat(optional).hasValue(value);

Suggested Commit Message 🎉

Suggestions?

Copy link
Member

@rickie rickie left a comment

Choose a reason for hiding this comment

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

Ahh nice that you opened the PR 🚀 !

We can probably add one case to the Refaster rule above here AbstractOptionalAssertHasValue.

The build will probably fail as we also need to add tests 😄. Try running mvn clean install to see whether the build passes 😉.

@JulianBroudy
Copy link
Author

We can probably add one case to the Refaster rule above here AbstractOptionalAssertHasValue.

Maybe we can go over it together? Because IIUC we cannot add the following:
image

If we stay with the new function, should it maybe also return AbstractAssert<?, ?> instead of ObjectAssert<T>?

The build will probably fail as we also need to add tests 😄. Try running mvn clean install to see whether the build passes 😉.

On it!

Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@JulianBroudy JulianBroudy requested a review from rickie February 18, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants