-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Use checkstyle to forbid JUnit 3 and some other internal packages. #114
Conversation
@@ -155,8 +153,7 @@ public void testSizeCallbackIsNotCalledPreDrawIfNoDimensSetOnPreDraw() { | |||
shadowObserver.fireOnPreDrawListeners(); | |||
|
|||
verify(cb, never()).onSizeReady(anyInt(), anyInt()); | |||
TestCase.assertEquals(1, shadowObserver.getPreDrawListeners() | |||
.size()); | |||
assertEquals(1, shadowObserver.getPreDrawListeners().size()); |
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.
Another nit: you can use assertThat(shadowObserver.getPreDrawListeners(), hasSIze(1))
. http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matchers.html#hasSize(int).
Now that I think about it, there are actually probably a bunch of places where I'm using assertTrue or assertFalse and hamcrest has better alternatives available. Assuming that's the case, don't feel obligated to fix all of that now.
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.
don't feel obligated to fix all of that now.
I already did :)
As for the hasSize, I know about it, but I didn't see the right of the line, I was focused on getting consistent imports. But good point, I'll take a look at all .size() usages as well.
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.
Ah I just saw a few imports for assertTrue/assertFalse and didn't look more closely. Thanks for doing this!
Awesome, looks great. I just started looking at Hamcrest yesterday after some of your previous pull requests, and it's a really nice library. This is much easier to read and it's great to have explicit error messages. |
If you want to try to rebase this on top of master I'll wait to merge this, otherwise if it's all set let me know and I'll hit the button. |
Isn't it already on master? |
Yes, but you can make the history slightly cleaner by rebasing on top of the most recent changes. It's a git thing. If you branch at commit A, and create commit B on your branch, but in the meantime, commits C and D are added on top of A in master: A B You get a branch in the commit history when you merge: master If you instead rebase and then merge, you get a 'fast forward' and have a linear history: master No big deal either way, some people think all 'merges' in git should be fast forwards and therefore all branches should be rebased before the merge. Doesn't matter much to me either way, if you don't care, I'm happy to just merge. |
… to org.junit.Assert. Fixes bumptech#106.
…assertion changes
Hmm, that's new, - and finally I know what it means if a commit has 2 parents :) - but I think that's the way it should be... if you draw your commit history a little differently:
This way it's clear what was the order of the commits in reality.
I would keep the "Merge" commits as well if I had a repo, but here yo' da boss. I'll rebase it now. |
Awesome, nice work, thank you! |
Use checkstyle to forbid JUnit 3 and some other internal packages.
Fix for #106 and more
Example checkstyle messages:
Example assertion errors achieved by using JUnit 4's assertThat and hamcrest-library Matchers.
To produce the error: commented out the
harness.doLoad();
lineTo produce the error: multiplied transformedAspectRatio by 100 making 10 -> 1000
To produce the error: multiplied width by 100 making 13 -> 1300
To produce the error: subtracted 1 from both width and height