### Question:
DataMask { public static String toString(Object object) { if (object == null) { return null; } try { String json = toJSONString(object); Object cloneObj = JSON.parseObject(json, object.getClass()); return cloneObj.toString(); } catch (Exception e) { return object.toString(); } }  static void setHashSalt(String salt); static String mask(String source); static String mask(String source, SensitiveType type); static String mask(String source,MaskStrategy strategy,int...param); static String toJSONString(Object object); static String toString(Object object);  }### Answer:
@Test public void testToString() { TestData testData = new TestData(); testData.setName("123"); testData.setPhone("1234567"); testData.setAccount("test"); testData.setHash("hash"); testData.setTest("123456"); String mask = DataMask.toString(testData); System.out.println(mask); testData.setName("**3"); testData.setPhone("12***67"); testData.setAccount("t***"); testData.setTest("1**456"); testData.setHash(new HashMask().mask("hash", null)); assertThat(mask).isEqualTo(testData.toString()); }
@Test public void testMapping() { TestUserMapingData data = new TestUserMapingData(); data.setNickName("nick"); data.setTel("13590909090"); String mask = DataMask.toString(data); System.out.println(mask); data.setNickName("**ck"); data.setTel("135*****090"); assertThat(mask).isEqualTo(data.toString()); }