-
Notifications
You must be signed in to change notification settings - Fork 509
Replace assert with assertThat in tests #130
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
Conversation
| @@ -11,6 +11,7 @@ | |||
|
|
|||
| import java.util.List; | |||
|
|
|||
| import static org.assertj.core.api.Assertions.assertThat; | |||
| import static org.junit.Assert.*; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need these imports any more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah those are still used across tests until Junit4 assertions are switched to AssertJ assertions
| assertThat(resp.getNextPageToken()).isNotNull(); | ||
| assertThat(resp.getTables()).hasSize(1) | ||
| .first() | ||
| .usingRecursiveComparison() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to be a change in the test logic. @ravivj-db could you double check this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is because previously the assert wasn't executed and the condition was actually never met (the single element in the list was never equal to the expectation due to tiny differences in the fields that were excluded here)
|
@nastra Thank you very much for the fixes and improvements! |
**PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [ ] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** The `assert` keyboard in Java needs to be explicitly enabled (via `-ea`), otherwise it doesn't do anything and gets optimized away. There are also a few `assert` usages in web service code and those should be replaced either with `Preconditions.checkNotNull` or with a Validation API
PR Checklist
docsis updatedDescription of changes
The
assertkeyboard in Java needs to be explicitly enabled (via-ea), otherwise it doesn't do anything and gets optimized away. There are also a fewassertusages in web service code and those should be replaced either withPreconditions.checkNotNullor with a Validation API