Refactor test case for Z3