Refactor code and uncomment test case
[Fixes #72752996] Refactor code and uncomment test cases