### Question:
MountainBikeFlagEncoder extends BikeCommonFlagEncoder { @Override public long handleRelationTags(ReaderRelation relation, long oldRelationFlags) { oldRelationFlags = super.handleRelationTags(relation, oldRelationFlags); int code = 0; if (relation.hasTag("route", "mtb")) code = PREFER.getValue(); int oldCode = (int) relationCodeEncoder.getValue(oldRelationFlags); if (oldCode < code) return relationCodeEncoder.setValue(0, code); return oldRelationFlags; } MountainBikeFlagEncoder();  MountainBikeFlagEncoder(PMap properties);  MountainBikeFlagEncoder(String propertiesStr);  MountainBikeFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts); @Override int getVersion(); @Override long handleRelationTags(ReaderRelation relation, long oldRelationFlags); @Override String toString();  }### Answer:
@Test public void testHandleWayTagsInfluencedByRelation() { ReaderWay osmWay = new ReaderWay(1); osmWay.setTag("highway", "track"); long allowed = encoder.acceptBit; ReaderRelation osmRel = new ReaderRelation(1); long relFlags = encoder.handleRelationTags(osmRel, 0); long flags = encoder.handleWayTags(osmWay, allowed, relFlags); assertEquals(18, encoder.getSpeed(flags), 1e-1); assertPriority(PriorityCode.PREFER.getValue(), osmWay); assertEquals("small way, unpaved", getWayTypeFromFlags(osmWay)); osmRel.setTag("route", "bicycle"); osmRel.setTag("network", "lcn"); relFlags = encoder.handleRelationTags(osmRel, 0); flags = encoder.handleWayTags(osmWay, allowed, relFlags); assertEquals(18, encoder.getSpeed(flags), 1e-1); assertPriority(PriorityCode.PREFER.getValue(), osmWay); assertEquals("small way, unpaved", getWayTypeFromFlags(osmWay)); osmRel.setTag("network", "rcn"); relFlags = encoder.handleRelationTags(osmRel, 0); flags = encoder.handleWayTags(osmWay, allowed, relFlags); assertPriority(PriorityCode.PREFER.getValue(), osmWay); assertEquals(18, encoder.getSpeed(flags), 1e-1); osmRel.setTag("network", "ncn"); relFlags = encoder.handleRelationTags(osmRel, 0); flags = encoder.handleWayTags(osmWay, allowed, relFlags); assertPriority(PriorityCode.PREFER.getValue(), osmWay); assertEquals(18, encoder.getSpeed(flags), 1e-1); osmWay.clearTags(); osmWay.setTag("highway", "tertiary"); osmRel.setTag("route", "bicycle"); osmRel.setTag("network", "lcn"); relFlags = encoder.handleRelationTags(osmRel, 0); flags = encoder.handleWayTags(osmWay, allowed, relFlags); assertEquals(18, encoder.getSpeed(flags), 1e-1); assertPriority(PriorityCode.PREFER.getValue(), osmWay); assertEquals("", getWayTypeFromFlags(osmWay)); }