SegmentParser { public MapInfo parseMap(RecordId parentId, RecordId mapId, MapRecord map) { if (map.isDiff()) { onMapDiff(parentId, mapId, map); } else if (map.isLeaf()) { onMapLeaf(parentId, mapId, map); } else { onMapBranch(parentId, mapId, map); } return new MapInfo(mapId, -1); } SegmentParser(@NotNull SegmentReader reader); NodeInfo parseNode(RecordId nodeId); TemplateInfo parseTemplate(RecordId templateId); MapInfo parseMap(RecordId parentId, RecordId mapId, MapRecord map); MapInfo parseMapDiff(RecordId mapId, MapRecord map); MapInfo parseMapLeaf(RecordId mapId, MapRecord map); MapInfo parseMapBranch(RecordId mapId, MapRecord map); PropertyInfo parseProperty(RecordId parentId, RecordId propertyId, PropertyTemplate template); ValueInfo parseValue(RecordId parentId, RecordId valueId, Type<?> type); BlobInfo parseBlob(RecordId blobId); BlobInfo parseString(RecordId stringId); ListInfo parseList(RecordId parentId, RecordId listId, int count); ListBucketInfo parseListBucket(RecordId listId, int index, int count, int capacity);  }
@Test public void emptyMap() throws IOException { Map<String, RecordId> empty = newHashMap(); MapRecord map = new MapRecord(store.getReader(), writer.writeMap(null, empty)); MapInfo mapInfo = new TestParser(store.getReader(), "emptyMap") { @Override protected void onMapLeaf(RecordId parentId, RecordId mapId, MapRecord map) { } }.parseMap(null, map.getRecordId(), map); assertEquals(map.getRecordId(), mapInfo.mapId); }