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

Improve test coverage of NodeLabelParameter #365

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

code-arnab
Copy link
Contributor

Testing done

Hello @MarkEWaite, Added some test case which improved the overall test coverage from 76% to 80%.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@code-arnab code-arnab requested a review from a team as a code owner December 16, 2024 19:12
@github-actions github-actions bot added the tests Automated test addition or improvement label Dec 16, 2024
https://jqno.nl/equalsverifier/ is much more thorough in testing the
equals and hashCode implementations.  Use it rather than crafting separate
tests of our own.
@github-actions github-actions bot added the dependencies Dependency related change label Dec 16, 2024
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks! Approved.

I switched the equals and hashCode tests to use equalsverifier instead. It performs a much deeper check of the equals implementation and the hashCode implementation and requires less code.

Used the same technique to test one other class that has an equals implementation in the class. There is still one class that has an equals implementation that is not checked by equalsverifier. My attempts to use equalsverifier on that class failed and I ran out of time to investigate further.

@MarkEWaite MarkEWaite merged commit af5e072 into jenkinsci:master Dec 16, 2024
18 checks passed
@code-arnab
Copy link
Contributor Author

Thanks! Approved.

I switched the equals and hashCode tests to use equalsverifier instead. It performs a much deeper check of the equals implementation and the hashCode implementation and requires less code.

Used the same technique to test one other class that has an equals implementation in the class. There is still one class that has an equals implementation that is not checked by equalsverifier. My attempts to use equalsverifier on that class failed and I ran out of time to investigate further.

Great! Thank You for switching to equalsverifier. I didn't know that there was already such a compact implementation is present.
Maybe I can try to make the equalsverifier work on that failed class it will help me learn more about the equalsverfier.

@MarkEWaite
Copy link
Contributor

Maybe I can try to make the equalsverifier work on that failed class it will help me learn more about the equalsverfier.

You're welcome to do that. It certainly is a way to learn and it will probably teach you many things about the relationship between the equals method, the hashCode method, and how those methods operate with Java inheritance. It is also fine if you ignore it and call that an advanced topic for another time.

@code-arnab
Copy link
Contributor Author

Maybe I can try to make the equalsverifier work on that failed class it will help me learn more about the equalsverfier.

You're welcome to do that. It certainly is a way to learn and it will probably teach you many things about the relationship between the equals method, the hashCode method, and how those methods operate with Java inheritance. It is also fine if you ignore it and call that an advanced topic for another time.

Sure 👍, if the implementation goes tangent to me I will move on to other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Dependency related change tests Automated test addition or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants