-
Notifications
You must be signed in to change notification settings - Fork 257
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
Add tests for ball logic in image resolver page #141
Conversation
Thanks for the pull request @Okhan-coder . In future pull requests, please create a branch for the changes instead of submitting it from your master branch. The first item in the submitter checklist says:
When you submit a pull request from your own master branch, you make your own development experience more complicated and you make it a little more complicated for the plugin maintainer. |
Apologies I will pay attention to that in the future thank you! |
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.
I started some experiments to create comparable tests without using mocks and it seemed to be working well. I ran out of time to complete those comparable tests, but if you're interested in my "work in progress" I could push them to this pull request (on your branch). Would that be OK or would you rather I push my prototypes to branch in my own repository that you can then use for comparison without it disrupting your branch?
In case you're interested in the experiments I was doing to try to use the objects directly rather than mocking, see https://github.com/MarkEWaite/embeddable-build-status-plugin/commits/Okhan-coder/master
src/test/java/org/jenkinsci/plugins/badge/ImageResolverTest.java
Outdated
Show resolved
Hide resolved
Known that some of the tests fail Exploring ideas
Confirm tests run without mocks
Co-authored-by: Mark Waite <[email protected]>
Pushing them to this pull request would be great thanks! |
Okhan coder/master Combine
Hello Mark, To make these tests work without mocks I had to make an extension of ImageResolver in the test. The reason for this is Color. getimageof () used the Stapler class which always returned a null pointer exception. I was unsure how to stop this from happening without mocks. If you have any solutions that don't include extensions to this let me know I can change the code. |
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.
Thanks. Sorry for the long delay on my feedback.
src/test/java/org/jenkinsci/plugins/badge/ImageResolverTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/badge/ImageResolverTest.java
Outdated
Show resolved
Hide resolved
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.
The tests that I added would benefit from more work, but that's only peripherally part of this pull request. The test you added looks good to me.
This merge has 3 unit tests covering Ball Logic, First Test sees if the default 32x32 image logic is correct. The second is just a regular ball, and 3rd is an empty test case. I also Updated Mockito so it works with Final classes. Still need to cover non-ball image requests but will handle that at a later time. #114