### Question:
BannerInstructionMilestone extends Milestone { @Override public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) { RouteLegProgress legProgress = routeProgress.currentLegProgress(); LegStep currentStep = legProgress.currentStep(); double stepDistanceRemaining = legProgress.currentStepProgress().distanceRemaining(); BannerInstructions instructions = routeUtils.findCurrentBannerInstructions(currentStep, stepDistanceRemaining); if (shouldBeShown(instructions, stepDistanceRemaining)) { this.instructions = instructions; return true; } return false; } BannerInstructionMilestone(Builder builder); @Override boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress); BannerInstructions getBannerInstructions();  }### Answer:
@Test public void onBeginningOfStep_bannerInstructionsShouldTrigger() throws Exception { RouteProgress routeProgress = buildDefaultTestRouteProgress(); routeProgress = createBeginningOfStepRouteProgress(routeProgress); BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); boolean isOccurring = milestone.isOccurring(routeProgress, routeProgress); assertTrue(isOccurring); }
@Test public void onSameInstructionOccurring_milestoneDoesNotTriggerTwice() throws Exception { RouteProgress routeProgress = buildDefaultTestRouteProgress(); RouteProgress firstProgress = createBeginningOfStepRouteProgress(routeProgress); double fortyMetersIntoStep = routeProgress.currentLegProgress().currentStep().distance() - 40; RouteProgress secondProgress = routeProgress.toBuilder() .stepDistanceRemaining(fortyMetersIntoStep) .stepIndex(0) .build(); BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); milestone.isOccurring(firstProgress, firstProgress); boolean shouldNotBeOccurring = milestone.isOccurring(firstProgress, secondProgress); assertFalse(shouldNotBeOccurring); }
@Test public void nullInstructions_MilestoneDoesNotGetTriggered() throws Exception { RouteProgress routeProgress = buildDefaultTestRouteProgress(); LegStep currentStep = routeProgress.currentLegProgress().currentStep(); List<BannerInstructions> instructions = currentStep.bannerInstructions(); instructions.clear(); routeProgress = createBeginningOfStepRouteProgress(routeProgress); BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); boolean isOccurring = milestone.isOccurring(routeProgress, routeProgress); assertFalse(isOccurring); }