### Question:
GenericWeighting extends AbstractWeighting { @Override public long calcMillis(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId) { double speed = weightingConfig.getSpeed(edgeState); if (speed == 0) return Long.MAX_VALUE; double maxspeed = gEncoder.getMaxspeed(edgeState, accessType, reverse); if (maxspeed > 0 && speed > maxspeed) speed = maxspeed; long timeInMillis = (long) (edgeState.getDistance() / speed * SPEED_CONV); boolean unfavoredEdge = edgeState.getBool(EdgeIteratorState.K_UNFAVORED_EDGE, false); if (unfavoredEdge) timeInMillis += headingPenaltyMillis; if (timeInMillis < 0) throw new IllegalStateException("Some problem with weight calculation: time:" + timeInMillis + ", speed:" + speed); return timeInMillis; } GenericWeighting(DataFlagEncoder encoder, PMap hintsMap); @Override double getMinWeight(double distance); @Override double calcWeight(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId); @Override long calcMillis(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId); @Override String getName(); static final String HEIGHT_LIMIT; static final String WEIGHT_LIMIT; static final String WIDTH_LIMIT; }### Answer:
@Test public void testCalcTime() { GenericWeighting weighting = new GenericWeighting(encoder, new HintsMap()); EdgeIteratorState edge = graph.getEdgeIteratorState(0, 1); assertEquals(edgeWeight, weighting.calcMillis(edge, false, EdgeIterator.NO_EDGE), .1); }