[IMP] Improve test case and reduce code new api.