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

Array assertions #289

Closed
wants to merge 1 commit into from
Closed

Conversation

lutovich
Copy link
Contributor

Overview

This commit introduces all possible variants of assertArrayEquals method for:

  • primitive types
  • float arrays within the given float delta
  • double arrays within the given double delta
  • object arrays, which are examined deeply like in Arrays#deepEquals()

I hereby agree to the terms of the JUnit Contributor License Agreement.

This commit introduces all possible variants of `assertArrayEquals` method for:
 - primitive types
 - `float` arrays within the given `float` delta
 - `double` arrays within the given `double` delta
 - object arrays, which are examined deeply like in `Arrays#deepEquals()`
@lutovich
Copy link
Contributor Author

Array assertions are in Assertions class and not in a dedicated helper like ArrayAssertions because:

  1. this reminds JUnit 4 and might feel more native to users
  2. they reuse private helper methods from Assertions to format values, compare numbers, etc.

At the same time, users mostly static import all assertion methods anyway so ArrayAssertions could be a good place. This will keep JUnit code a bit cleaner and make Assertions class a bit smaller. Item (2) could be solved by some helper class that holds all message formatting functionality.

Please let me know if array assertions should be moved to a separate class.

@sbrannen sbrannen added this to the 5.0 M1 milestone May 30, 2016
@sbrannen sbrannen self-assigned this May 30, 2016
@sbrannen
Copy link
Member

in progress

sbrannen added a commit that referenced this pull request May 30, 2016
* lutovich-array-assertions:
  Polishing
  Introduce assertArrayEquals() methods in Assertions
@sbrannen
Copy link
Member

This has been merged into master in 0ef3701.

@sbrannen
Copy link
Member

@lutovich,

Thanks for the contribution.

Well implemented and thoroughly tested! 👍

Regarding creating a new ArrayAssertions class, I agree that Assertions has become quite large in the meanwhile, but let's hold off on that for now.

@lutovich lutovich deleted the array-assertions branch May 30, 2016 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants