### Question:
MapUtil { public static Map<String,Object> objectToMap(Object obj) throws Exception{ return objectMapper.readValue(objectMapper.writeValueAsBytes(obj), Map.class); }  static Map<String, Object> convertToHashMap(Map<String, Object> target); static Map<String,Object> objectToMap(Object obj); static T jsonStrToObject(String jsonStr, Class<T> clazz);  }### Answer:
@Test public void testObjectToMap() { try { Map<String, Object> expect = new HashMap<>(); expect.put("key", "val"); Map<String, Object> result = MapUtil.objectToMap(new TestObj("val")); Assert.assertEquals(result, expect); } catch (Exception e) { Assert.fail(e.getMessage()); } }