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

Remove NavigationCamera ProgressChangeListener as public api #828

Merged
merged 2 commits into from
Apr 6, 2018

Conversation

danesfeder
Copy link
Contributor

Closes #826

Copy link
Contributor

@Guardiola31337 Guardiola31337 left a 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() {
Copy link
Contributor

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 {
Copy link
Contributor

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

MockitoAnnotations.initMocks(this);
camera = new NavigationCamera(mapboxMap, navigation);
code into a 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".

@danesfeder danesfeder merged commit c948856 into master Apr 6, 2018
@danesfeder danesfeder deleted the dan-nav-cam-listener branch April 6, 2018 14:09
@danesfeder danesfeder added this to the v0.13.0 milestone Apr 11, 2018
@danesfeder danesfeder mentioned this pull request May 3, 2018
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants