### Question:
Operation { public String toJSON(int maxCols) throws IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(toMap(maxCols)); }  abstract Map<String, Object> getFingerprint(); abstract Map<String, Object> toMap(int maxCols); Map<String, Object> toMap(); String toJSON(int maxCols); String toJSON(); String toString(int maxCols); @Override String toString();  }### Answer:
@Test public void testOperationJSON() throws IOException { Scan scan = new Scan(ROW); scan.addColumn(FAMILY, QUALIFIER); String json = scan.toJSON(); Map<String, Object> parsedJSON = mapper.readValue(json, HashMap.class); assertEquals("startRow incorrect in Scan.toJSON()", Bytes.toStringBinary(ROW), parsedJSON.get("startRow")); List familyInfo = (List) ((Map) parsedJSON.get("families")).get( Bytes.toStringBinary(FAMILY)); assertNotNull("Family absent in Scan.toJSON()", familyInfo); assertEquals("Qualifier absent in Scan.toJSON()", 1, familyInfo.size()); assertEquals("Qualifier incorrect in Scan.toJSON()", Bytes.toStringBinary(QUALIFIER), familyInfo.get(0)); Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); json = get.toJSON(); parsedJSON = mapper.readValue(json, HashMap.class); assertEquals("row incorrect in Get.toJSON()", Bytes.toStringBinary(ROW), parsedJSON.get("row")); familyInfo = (List) ((Map) parsedJSON.get("families")).get( Bytes.toStringBinary(FAMILY)); assertNotNull("Family absent in Get.toJSON()", familyInfo); assertEquals("Qualifier absent in Get.toJSON()", 1, familyInfo.size()); assertEquals("Qualifier incorrect in Get.toJSON()", Bytes.toStringBinary(QUALIFIER), familyInfo.get(0)); Put put = new Put(ROW); put.add(FAMILY, QUALIFIER, VALUE); json = put.toJSON(); parsedJSON = mapper.readValue(json, HashMap.class); assertEquals("row absent in Put.toJSON()", Bytes.toStringBinary(ROW), parsedJSON.get("row")); familyInfo = (List) ((Map) parsedJSON.get("families")).get( Bytes.toStringBinary(FAMILY)); assertNotNull("Family absent in Put.toJSON()", familyInfo); assertEquals("KeyValue absent in Put.toJSON()", 1, familyInfo.size()); Map kvMap = (Map) familyInfo.get(0); assertEquals("Qualifier incorrect in Put.toJSON()", Bytes.toStringBinary(QUALIFIER), kvMap.get("qualifier")); assertEquals("Value length incorrect in Put.toJSON()", VALUE.length, kvMap.get("vlen")); Delete delete = new Delete(ROW); delete.deleteColumn(FAMILY, QUALIFIER); json = delete.toJSON(); parsedJSON = mapper.readValue(json, HashMap.class); assertEquals("row absent in Delete.toJSON()", Bytes.toStringBinary(ROW), parsedJSON.get("row")); familyInfo = (List) ((Map) parsedJSON.get("families")).get( Bytes.toStringBinary(FAMILY)); assertNotNull("Family absent in Delete.toJSON()", familyInfo); assertEquals("KeyValue absent in Delete.toJSON()", 1, familyInfo.size()); kvMap = (Map) familyInfo.get(0); assertEquals("Qualifier incorrect in Delete.toJSON()", Bytes.toStringBinary(QUALIFIER), kvMap.get("qualifier")); }