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

Assertions refactoring #6

Merged

Conversation

SylvainJuge
Copy link

@SylvainJuge SylvainJuge commented Dec 5, 2024

  • creating a dedicated AttributeMatcherSet class that is backed by a map
  • using a dedicated collection class allows to avoid warnings with varargs parameters with have with Collection<?>... for method arguments.
  • attribute keys uniqueness is enforced by the map collector.
  • rename to "attribute group" to avoid ambiguity with Set in java collections

* @param attributes attributes to check as map
* @return {@literal true} when the attributes match all attributes from this set
*/
public boolean matches(Map<String, String> attributes) {
Copy link
Author

@SylvainJuge SylvainJuge Dec 5, 2024

Choose a reason for hiding this comment

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

[for reviewer] we can move part of the matching logic here as we don't need to generate the assertions from here. details on potential mismatches are provided by the calling code in MetricAssert. Another benefit of doing this is that is allows to not expose elsewhere that it's stored in map.

@SylvainJuge SylvainJuge marked this pull request as ready for review December 6, 2024 15:03
@robsunday robsunday merged commit dfe3af3 into robsunday:assertions-refactoring Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants