### Question:
JacksonUndoLogParser implements UndoLogParser, Initialize { @Override public byte[] encode(BranchUndoLog branchUndoLog) { try { return mapper.writeValueAsBytes(branchUndoLog); } catch (JsonProcessingException e) { LOGGER.error("json encode exception, {}", e.getMessage(), e); throw new RuntimeException(e); } }  @Override void init(); @Override String getName(); @Override byte[] getDefaultContent(); @Override byte[] encode(BranchUndoLog branchUndoLog); @Override BranchUndoLog decode(byte[] bytes); static final String NAME; }### Answer:
@Test public void encode() throws NoSuchFieldException, IllegalAccessException, IOException, SQLException { java.lang.reflect.Field reflectField = parser.getClass().getDeclaredField("mapper"); reflectField.setAccessible(true); ObjectMapper mapper = (ObjectMapper)reflectField.get(parser); Field field = new Field("bigint_type", JDBCType.BIGINT.getVendorTypeNumber(), 9223372036854775807L); byte[] bytes = mapper.writeValueAsBytes(field); Field sameField = mapper.readValue(bytes, Field.class); Assertions.assertTrue(DataCompareUtils.isFieldEquals(field, sameField).getResult()); field = new Field("decimal_type", JDBCType.DECIMAL.getVendorTypeNumber(), new BigDecimal("55555555555555555555.55555555555555555555")); bytes = mapper.writeValueAsBytes(field); sameField = mapper.readValue(bytes, Field.class); Assertions.assertTrue(DataCompareUtils.isFieldEquals(field, sameField).getResult()); field = new Field("double_type", JDBCType.DOUBLE.getVendorTypeNumber(), 999999.999999999); bytes = mapper.writeValueAsBytes(field); sameField = mapper.readValue(bytes, Field.class); Assertions.assertTrue(DataCompareUtils.isFieldEquals(field, sameField).getResult()); field = new Field("timestamp_type", JDBCType.TIMESTAMP.getVendorTypeNumber(), Timestamp.valueOf("2019-08-10 10:49:26.926554")); bytes = mapper.writeValueAsBytes(field); sameField = mapper.readValue(bytes, Field.class); Assertions.assertTrue(DataCompareUtils.isFieldEquals(field, sameField).getResult()); field = new Field("blob_type", JDBCType.BLOB.getVendorTypeNumber(), new SerialBlob("hello".getBytes())); bytes = mapper.writeValueAsBytes(field); sameField = mapper.readValue(bytes, Field.class); Assertions.assertTrue(DataCompareUtils.isFieldEquals(field, sameField).getResult()); field = new Field("clob_type", JDBCType.CLOB.getVendorTypeNumber(), new SerialClob("hello".toCharArray())); bytes = mapper.writeValueAsBytes(field); sameField = mapper.readValue(bytes, Field.class); Assertions.assertTrue(DataCompareUtils.isFieldEquals(field, sameField).getResult()); }