### Question:
MapParser extends ContentParserBase implements ContentParser<Map<String, Object>> { @Override public ParseResults parse(Map<String, Object> source) throws BagriException { ParserContext ctx = initContext(); ctx.addDocument("/"); parseMap(ctx, source); return ctx.getParseResults(); } MapParser(ModelManagement model); @Override void init(Properties properties); @Override ParseResults parse(Map<String, Object> source); @Override ParseResults parse(File file); @Override ParseResults parse(InputStream stream); @Override ParseResults parse(Reader reader);  }### Answer:
@Test public void testParse() throws Exception { ModelManagement model = new ModelManagementImpl(); MapParser parser = new MapParser(model); Map<String, Object> content = new HashMap<>(); content.put("firstName", "John"); content.put("lastName", "Smith"); content.put("age", 25L); ParseResults results = parser.parse(content); List<Data> data = results.getResults(); assertNotNull(data); assertEquals(4, data.size()); }
@Test public void testByteArray() throws Exception { ModelManagement model = new ModelManagementImpl(); MapParser parser = new MapParser(model); Map<String, Object> content = new HashMap<>(); content.put("firstName", "John".getBytes()); content.put("lastName", "Smith".getBytes()); content.put("age", new byte[] {25}); ParseResults results = parser.parse(content); assertEquals(4, results.getResultSize()); List<Data> data = results.getResults(); assertEquals(4, data.size()); int length = 8 + "@firstName".length() + "John".getBytes().length + "@lastName".length() + "Smith".getBytes().length + "@age".length() + 1; assertEquals(length, results.getContentLength()); }