issue #2572, Optimize the code of test case for issue 2572.