-
Notifications
You must be signed in to change notification settings - Fork 41k
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
Use idiomatic AssertJ assertions #38702
Conversation
Thanks, @quaff.
I like this pair of changes. Thanks.
I'm neutral on this one.
I don't like this change. It's more verbose and I don't think it makes the code easier to read. On balance, I think my preference would be to just keep the first type of change and revert the other two. Let's see what the rest of the team thinks. |
It will report more meaningful error not just for readable consideration. |
Deliberately breaking one of the assertions, here's the error before the proposed change:
And here's the error afterwards:
For me, the addition of |
It's indeed more, let's wait for feedbacks from others. |
I like 1 and 2. I do think that I don't like 3 either. |
I like 1 but I don't think 2 or 3 give enough value given the number of files they change. |
Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty() Search for : assertThat\((.+).isEmpty\(\)\).isTrue\(\) Replace with : assertThat($1).isEmpty() Search for : assertThat\((.+).isEmpty\(\)\).isFalse\(\) Replace with : assertThat($1).isNotEmpty()
OK, I've updated the commit. |
Thank you! |
Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty() Search for : assertThat((.+).isEmpty()).isTrue() Replace with : assertThat($1).isEmpty()
Search for : assertThat((.+).isEmpty()).isFalse() Replace with : assertThat($1).isNotEmpty()
Replace assertThat(x.iterator().next()) with assertThat(x).element(0) Search for : assertThat((.+).iterator().next()) Replace with : assertThat($1).element(0)
Replace assertThat(x.get(i)). with assertThat(x).element(i). Search for : assertThat((.+).get((\d+))).
Replace with : assertThat($1).element($2).