### Question:
OSMSurfaceParser implements TagParser { @Override public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay readerWay, boolean ferry, IntsRef relationFlags) { String surfaceTag = readerWay.getTag("surface"); Surface surface = Surface.find(surfaceTag); if (surface == OTHER && !Helper.isEmpty(surfaceTag)) { if (surfaceTag.equals("metal")) surface = PAVED; else if (surfaceTag.equals("sett")) surface = COBBLESTONE; else if (surfaceTag.equals("wood")) surface = UNPAVED; else if (surfaceTag.equals("earth")) surface = DIRT; } if (surface != OTHER) surfaceEnc.setEnum(false, edgeFlags, surface); return edgeFlags; } OSMSurfaceParser();  OSMSurfaceParser(EnumEncodedValue<Surface> surfaceEnc); @Override void createEncodedValues(EncodedValueLookup lookup, List<EncodedValue> list); @Override IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay readerWay, boolean ferry, IntsRef relationFlags);  }### Answer:
@Test public void testSimpleTags() { IntsRef relFlags = em.createRelationFlags(); ReaderWay readerWay = new ReaderWay(1); IntsRef intsRef = em.createEdgeFlags(); readerWay.setTag("highway", "primary"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Surface.OTHER, surfaceEnc.getEnum(false, intsRef)); readerWay.setTag("surface", "cobblestone"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Surface.COBBLESTONE, surfaceEnc.getEnum(false, intsRef)); assertTrue(Surface.COBBLESTONE.ordinal() > Surface.ASPHALT.ordinal()); readerWay.setTag("surface", "earth"); parser.handleWayTags(intsRef, readerWay, false, relFlags); assertEquals(Surface.DIRT, surfaceEnc.getEnum(false, intsRef)); }