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

Fix OffRoute detection disabled bug #783

Merged
merged 2 commits into from
Mar 22, 2018
Merged

Fix OffRoute detection disabled bug #783

merged 2 commits into from
Mar 22, 2018

Conversation

danesfeder
Copy link
Contributor

Closes #780

@danesfeder danesfeder added bug Defect to be fixed. navigation-core labels Mar 19, 2018
@danesfeder danesfeder self-assigned this Mar 19, 2018
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.

Some comments on the tests (not blocker though)

@@ -70,6 +69,39 @@ public void defaultEngines_didGetInitialized() throws Exception {
assertNotNull(navigation.getOffRouteEngine());
}

@Test
public void offRouteEngine_doesNotGetInitializedWithFalseOption() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally is good to structure the tests following the triple A 👀 https://speakerdeck.com/guardiola31337/elegant-unit-testing-mobilization-2016?slide=40 http://wiki.c2.com/?ArrangeActAssert
If the Arrange part gets too long we should create factory or builder methods.

This applies to other tests included in MapboxNavigationTest.

navigation = new MapboxNavigation(mock(Context.class), ACCESS_TOKEN, options, mock(NavigationTelemetry.class),
mock(LocationEngine.class));
assertNull(navigation.getOffRouteEngine());
initDefaultNavigation();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is initDefaultNavigation() needed?

👀 FIRST


List<Milestone> triggeredMilestones
= checkMilestones(routeProgress, routeProgress, mapboxNavigation);
assertEquals(1, triggeredMilestones.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally is preferable having only 1 assertion per test 👀 https://speakerdeck.com/guardiola31337/elegant-unit-testing-mobilization-2016?slide=57

@danesfeder danesfeder merged commit d998ece into master Mar 22, 2018
@danesfeder danesfeder deleted the dan-off-route-bug branch March 22, 2018 16:31
@danesfeder danesfeder mentioned this pull request Apr 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