Skip to content

Improve collection assertions#19841

Merged
findepi merged 4 commits intotrinodb:masterfrom
findepi:findepi/improve-map-assertions-for-map-entries-b0d9bc
Nov 21, 2023
Merged

Improve collection assertions#19841
findepi merged 4 commits intotrinodb:masterfrom
findepi:findepi/improve-map-assertions-for-map-entries-b0d9bc

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented Nov 21, 2023

Use assertion patterns that produce useful error messages on failures.

  • Use AbstractIterableAssert#contains instead of assertThat(list.contains(...)).isTrue()
  • Use AbstractMapAssert#containsKey instead of assertThat(map.containsKey(...)).isTrue().
  • Use AbstractMapAssert#containsEntry instead of assertThat(map.get(...)).isEqualTo(...)

Use `AbstractIterableAssert#contains` instead of
`assertThat(list.contains(...)).isTrue()`. The `isTrue` version
produces less useful error messages.
Use `AbstractMapAssert#containsKey` instead of
`assertThat(map.containsKey(...)).isTrue()`. The `isTrue` version
produces less useful error messages.
Use `AbstractMapAssert#containsEntry` instead of
`assertThat(map.get(...)).isEqualTo(...)`. The `isEqualTo` version
produces less useful error message, because it does not know the map key
being asserted.
@findepi findepi requested a review from wendigo November 21, 2023 08:10
@cla-bot cla-bot bot added the cla-signed label Nov 21, 2023
@github-actions github-actions bot added jdbc Relates to Trino JDBC driver tests:hive iceberg Iceberg connector delta-lake Delta Lake connector hive Hive connector labels Nov 21, 2023
@findepi
Copy link
Copy Markdown
Member Author

findepi commented Nov 21, 2023

CI #11252

Copy link
Copy Markdown
Contributor

@ksobolew ksobolew left a comment

Choose a reason for hiding this comment

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

My favourite kind of commit! 🙌

@findepi
Copy link
Copy Markdown
Member Author

findepi commented Nov 21, 2023

CI #16315 (twice)

@findepi findepi merged commit ccf6b62 into trinodb:master Nov 21, 2023
@findepi findepi deleted the findepi/improve-map-assertions-for-map-entries-b0d9bc branch November 21, 2023 16:29
@github-actions github-actions bot added this to the 434 milestone Nov 21, 2023
@mosabua
Copy link
Copy Markdown
Member

mosabua commented Nov 21, 2023

No release notes since this it testing stuff

@findepi findepi added the no-release-notes This pull request does not require release notes entry label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed delta-lake Delta Lake connector hive Hive connector iceberg Iceberg connector jdbc Relates to Trino JDBC driver no-release-notes This pull request does not require release notes entry

Development

Successfully merging this pull request may close these issues.

4 participants