ObjHexStringConverter { public static String object2hex(Serializable obj) throws IOException { ByteArrayOutputStream bytesout = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bytesout); oos.writeObject(obj); oos.flush(); String hexString = Hex.encodeHexString(bytesout.toByteArray()); bytesout.close(); oos.close(); return hexString; }  static String object2hex(Serializable obj); static Object hex2obj(String hexString);  }
@Test void object2hex() throws Exception { Assertions.assertDoesNotThrow(() -> ObjHexStringConverter.object2hex((Integer)i)); Assertions.assertDoesNotThrow(() -> ObjHexStringConverter.object2hex(termId)); }