@Test void distance_to_location_should_equal_value_in_distance_map() { HashMap<Long, Distance> distanceMap = new HashMap<>(); long otherId = 321; long millis = 777777; distanceMap.put(otherId, Distance.ofMillis(millis)); Location domainLocation = new Location(1, Coordinates.valueOf(0, 0)); PlanningLocation planningLocation = new PlanningLocation( domainLocation.id(), domainLocation.coordinates().latitude().doubleValue(), domainLocation.coordinates().longitude().doubleValue(), new DistanceMapImpl(distanceMap::get)); assertThat(planningLocation.distanceTo(testLocation(otherId))).isEqualTo(millis); }
public long distanceTo(PlanningLocation location) { if (this == location) { return 0L; } return travelDistanceMap.distanceTo(location); }
PlanningLocation { public long distanceTo(PlanningLocation location) { if (this == location) { return 0L; } return travelDistanceMap.distanceTo(location); } }
PlanningLocation { public long distanceTo(PlanningLocation location) { if (this == location) { return 0L; } return travelDistanceMap.distanceTo(location); } PlanningLocation(long id, double latitude, double longitude, DistanceMap travelDistanceMap); }
PlanningLocation { public long distanceTo(PlanningLocation location) { if (this == location) { return 0L; } return travelDistanceMap.distanceTo(location); } PlanningLocation(long id, double latitude, double longitude, DistanceMap travelDistanceMap); long getId(); long distanceTo(PlanningLocation location); double angleTo(PlanningLocation location); @Override String toString(); }
PlanningLocation { public long distanceTo(PlanningLocation location) { if (this == location) { return 0L; } return travelDistanceMap.distanceTo(location); } PlanningLocation(long id, double latitude, double longitude, DistanceMap travelDistanceMap); long getId(); long distanceTo(PlanningLocation location); double angleTo(PlanningLocation location); @Override String toString();  }