### Question:
OSMTollParser implements TagParser { @Override public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay readerWay, boolean ferry, IntsRef relationFlags) { if (readerWay.hasTag("toll", "yes")) tollEnc.setEnum(false, edgeFlags, Toll.ALL); else if (readerWay.hasTag("toll:hgv", "yes")) tollEnc.setEnum(false, edgeFlags, Toll.HGV); else if (readerWay.hasTag("toll:N2", "yes")) tollEnc.setEnum(false, edgeFlags, Toll.HGV); else if (readerWay.hasTag("toll:N3", "yes")) tollEnc.setEnum(false, edgeFlags, Toll.HGV); return edgeFlags; } OSMTollParser(); @Override void createEncodedValues(EncodedValueLookup lookup, List<EncodedValue> list); @Override IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay readerWay, boolean ferry, IntsRef relationFlags);  }### Answer:
@Test public void testSimpleTags() { ReaderWay readerWay = new ReaderWay(1); IntsRef relFlags = em.createRelationFlags(); IntsRef intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Toll.NO, tollEnc.getEnum(false, intsRef)); intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); readerWay.setTag("toll:hgv", "yes"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Toll.HGV, tollEnc.getEnum(false, intsRef)); intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); readerWay.setTag("toll:N2", "yes"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Toll.HGV, tollEnc.getEnum(false, intsRef)); intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); readerWay.setTag("toll:N3", "yes"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Toll.HGV, tollEnc.getEnum(false, intsRef)); intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); readerWay.setTag("toll", "yes"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Toll.ALL, tollEnc.getEnum(false, intsRef)); intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); readerWay.setTag("toll", "yes"); readerWay.setTag("toll:hgv", "yes"); readerWay.setTag("toll:N2", "yes"); readerWay.setTag("toll:N3", "yes"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Toll.ALL, tollEnc.getEnum(false, intsRef)); }