-
Notifications
You must be signed in to change notification settings - Fork 319
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
Remove NavigationCamera ProgressChangeListener as public api #828
Conversation
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.
#826 is a great example of why we always should be really careful of what we expose publicly. This reminds me to 👇
Classes are private until the opposite is proved.
😂
Minor comments not blocking the PR, other than that 🚀
* @param location used to update the camera position | ||
* @param routeProgress ignored in this scenario | ||
*/ | ||
ProgressChangeListener progressChangeListener = new ProgressChangeListener() { |
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.
NIT Could we move this up with the rest of the variables?
|
||
import static junit.framework.Assert.assertFalse; | ||
import static junit.framework.Assert.assertNotNull; | ||
import static junit.framework.Assert.assertTrue; | ||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
@Config(constants = BuildConfig.class, manifest = Config.DEFAULT_MANIFEST_NAME) | ||
public class NavigationCameraTest { |
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.
NIT This is a great opportunity to refactor the tests 🎉
In general, we should avoid inline setup 👀 https://speakerdeck.com/guardiola31337/elegant-unit-testing-mobilization-2016?slide=65
Could you remove navigation
and mapboxMap
mock variables and extract
Lines 35 to 36 in 98ffc5e
MockitoAnnotations.initMocks(this); | |
camera = new NavigationCamera(mapboxMap, navigation); |
private
"factory" method called for example setupCamera
and use it across the tests?IMO, it reflects better what's going on in the test and you don't break the triple A "rule".
9185567
to
f4b1c46
Compare
Closes #826